1.1.2 • Published 10 years ago
mock-fun v1.1.2
node-mock-fun
Mock functions
Install
npm install mock-fun
Usage
Use with mocha :3
var override = require('mock-fun').override;
var restore = require('mock-fun').restore;
describe('My library method', function() {
beforeEach(override(mylib, 'otherFun', function() {}));
afterEach(restore(mylib, 'otherFun'));
it('should call `otherFun`', function() {
mylib.fun();
mylib.otherFun.called.should.be.true;
});
});
License
MIT