@quarterto/stub-all
v1.1.0
Published
simplifies creating a lot of (sinon) stubs in your (mocha) tests
Downloads
6
Readme
stub-all
simplifies creating a lot of (sinon) stubs in your (mocha) tests
installation
npm install @quarterto/stub-allusage
const stubAll = require('@quarterto/stub-all');
const sinon = require('sinon');
describe('foo', () => {
stubAll(() => [
sinon.stub(foo, 'bar'),
sinon.stub(foo, 'baz'),
sinon.stub(foo, 'quux'),
])
});Pass a function returning an array of stubs to stubAll. It calls the function in before, creating your stubs, resets them all in beforeEach (making sure things like wasCalled are clean in each test, and restores them all in after.
licence
ISC
