@quarterto/stub-all

1.1.0 • Public • Published

stub-all

simplifies creating a lot of (sinon) stubs in your (mocha) tests

installation

npm install @quarterto/stub-all

usage

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

Readme

Keywords

none

Package Sidebar

Install

npm i @quarterto/stub-all

Weekly Downloads

0

Version

1.1.0

License

none

Last publish

Collaborators

  • quarterto