1.0.0 • Published 5 years ago
mgspy v1.0.0
MgSpy
Simple spy function for unit testing
Install
npm install mgspy
Usage
const makeSpy = require('mgspy');
// Tested function
function tested(callMe) {
callMe("test");
}
it("Should call 'callMe' with one argument", () => {
const mockCallMe = makeSpy();
tested(mockCallMe);
expect(mockCallMe.called).to.equal(true);
expect(mockCallMe.lastArguments.length).to.equal(1);
expect(mockCallMe.lastArguments[0]).to.equal("test");
})
1.0.0
5 years ago