Chai for Sinon
It's Chai with some added assertions for Sinon.
Usage
Replace require('chai')
with require('chai-for-sinon')
.
Example:
var chai = expect = chaiexpect;
or
Add require('chai-for-sinon')
after requiring Chai.
Example:
var chai = ;;
Assertions
The assertions that are added.
calledOnce()
Assert that the spy/stub/mock function was called once.
Example:
tobe;
calledWith(arg1[, ...])
Assert that the spy/stub/mock function was called with the arguments passed to this function.
Example:
tobe;
calledWithMatch(arg1[, ...])
Assert that the spy/stub/mock function was called with arguments matching the ones passed to this function. Each argument will be wrapped in a Sinon matcher.
Example:
tobe;
thrown()
Assert that the spy/stub/mock threw an exception when it was called.
Example:
tohave;