Skip to content

kurowski/moksi

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Moksi

Moksi is a stubbing and mocking library for JavaScript.

var Person = {
  name: function() {
    return 'Alice';
  },
  age: function() {
    return 28;
  }
}

// Stub the person's name.
Moksi.stub(Person, 'name', function() {
  return 'Bob';
});
Person.name() == 'Bob';

// Expect age to be called
Moksi.expects(Person, 'age');
Moksi.rejects(Person, 'name');
Person.age();
Moksi.assertExpectations(this);

// Revert all stubs and expectations
Moksi.revert(); 
Person.name() == 'Alice';

About

Mocking and stubbing in JavaScript.

Resources

Stars

Watchers

Forks

Packages

No packages published