Closed solsson closed 9 years ago
Thanks, I've made some changes. Let me know if this works for you.
Works as expected.
For now the pattern how I use the lib looks like:
var mocks = require('simple-mock');
var someTestObject = {
...
someFunction: mocks.spy(function() { return 'a-return-value-if-desired'; })
...
};
// somewhere is a procedure-like Mocha test
expect(someTestObject.someFunction.called).to.be.true();
someTestObject.someFunction.reset(); // to simplify for it:s below
I'm guessing sequences of returnWith will come in handy soon.
Thanks for writing such a nicely scoped lib.
Glad that's what you need. Thanks for the feedback.
In your example, changing to mocks.stub().returnWith('a-return-value-if-desired')
wouldn't be a big improvement, but if you were expecting multiple calls with different return values, it could help.
I felt the need to reset a specific spy to its initial state, with no calls logged.
Right now doing:
Is there such a method already, that doesn't affect other mocks? If not I can suggest one in my fork.