Skip to content

smtlaissezfaire/espionage

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

espionage

A javascript mocking/stubbing framework

stubbing

var obj = {};

obj.stub("foo")
obj.hasOwnProperty("foo") #=> true

obj.stub("foo", 1);
obj.foo() # => 1

obj.stub("bar", 2);
obj.bar() # => 2

obj.stub("foo", function(x) { return x; });
obj.foo()        # => undefined
obj.foo(1)       #=> 1
obj.foo("hello") #=> "hello"

mock expectations / test spies:

var obj = {}

spyOn(obj, function() {
  obj.foo();
  obj.received("foo") #=> true
});

spyOn(obj, function() {
  obj.foo();
  obj.received("bar") #=> false
});

About

Javascript mocking and stubbing framework

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published