Skip to content

Patch sinon to provide methods that allows to check spy invocation with called before/after sequence of spies.

License

Notifications You must be signed in to change notification settings

killmenot/sinon-called-sequence

Repository files navigation

Sinon called sequence

Build Status Dependency Status Coverage Status npm version

Patch sinon to provide methods that allow to check spy invocation with called before/after sequence of spies.

Install

npm i sinon sinon-called-sequence --save-dev

Requirements

  • Node.js 6+
  • Sinon >=5

How to use?

const sinon = require('sinon');
require('sinon-called-sequence');

const spy1 = sinon.spy();
const spy2 = sinon.spy();
const spy3 = sinon.spy();
const spy4 = sinon.spy();

spy1();
spy2();
spy3();
spy4();

spy1.calledBeforeSequence(spy2, spy4); // true
spy1.calledImmediatelyBeforeSequence(spy2, spy3, spy4); // true
spy4.calledAfterSequence(spy3, spy1); // true
spy4.calledImmediatelyAfterSequence(spy3, spy2, spy1); // true

License

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

About

Patch sinon to provide methods that allows to check spy invocation with called before/after sequence of spies.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published