sinon issue #2016 - resetHistory
// Employs 'mini-mocha' to emulate running in the Mocha test runner (mochajs.org)
require("@fatso83/mini-mocha").install();
const sinon = require("sinon");
const {assert} = require('referee');
describe('resetHistory', function() {
var num = null;
beforeEach(function() {
console.log("hello");
num = sinon.createStubInstance(Number);
});
afterEach(() => {
// Restore the default sandbox here
sinon.restore();
});
describe('called on individual stub method', function() {
it('should clear "called" status on stub', function() {
num.toFixed();
assert.isTrue(num.toFixed.called);
num.toFixed.resetHistory();
assert.isFalse(num.toFixed.called);
});
});
describe('called on module', function() {
it('should clear "called" status on all stubs', function() {
num.toFixed();
assert.isTrue(num.toFixed.called);
sinon.resetHistory();
assert.isFalse(num.toFixed.called);
});
});
});
no comments