https://github.com/lightsofapollo/sinon-expect
Sinon Matchers for expect.
https://github.com/lightsofapollo/sinon-expect
Last synced: about 1 year ago
JSON representation
Sinon Matchers for expect.
- Host: GitHub
- URL: https://github.com/lightsofapollo/sinon-expect
- Owner: lightsofapollo
- License: mit
- Created: 2012-02-05T21:51:45.000Z (over 14 years ago)
- Default Branch: master
- Last Pushed: 2016-03-16T04:30:23.000Z (over 10 years ago)
- Last Synced: 2025-04-02T10:07:18.764Z (about 1 year ago)
- Language: JavaScript
- Homepage:
- Size: 9.77 KB
- Stars: 13
- Watchers: 1
- Forks: 2
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- Changelog: HISTORY.md
- License: LICENSE
Awesome Lists containing this project
README
# Sinon Expect
Sinon expect is a wrapper for the assertions built into sinon.
A quick example is:
```javascript
var object = {
method: function(){}
};
//Yes we are overriding expect
//You can also save it to another variable but that is ugly
expect = require('sinon-expect').enhance(expect, sinon, 'was');
sinon.spy(object, 'method');
//Assert style
sinon.assert.called(object.method);
//Expect style
//All assertions are found under the .spy namespace/"flag"
expect(object.method).was.called();
```
## List Of Supported Assertions/Matchers
See [Sinon Assertions](http://sinonjs.org/docs/#assertions)
for additional documentation for each of these assertions.
Drop the first argument (the spy) otherwise the method signature
is the same.
- notCalled
- called
- calledOnce
- calledTwice
- calledThrice
- callCount
- callOrder
- calledOn
- alwaysCalledOn
- calledWith
- alwaysCalledWith
- neverCalledWith
- calledWithExactly
- alwaysCalledWithExactly
- threw
- alwaysThrew
# License
MIT (see LICENSE)