Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

chai-for-sinon

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chai-for-sinon - npm Package Compare versions

Comparing version 0.0.1 to 0.1.0

test/mocha.opts

9

package.json
{
"name": "chai-for-sinon",
"description": "It's Chai with some added assertions for Sinon.",
"version": "0.0.1",
"version": "0.1.0",
"author": "Brett Ausmeier <brett@ausmeier.co.za>",

@@ -18,3 +18,10 @@ "main": "./SinonAssertions",

"chai": "~1.8.1"
},
"devDependencies": {
"sinon": "~1.7.3",
"mocha": "~1.13.0"
},
"scripts": {
"test": "mocha"
}
}

@@ -10,3 +10,3 @@ # Chai for Sinon

Example:
```
```javascript
var chai = require('chai-for-sinon'),

@@ -21,3 +21,3 @@ expect = chai.expect;

Example:
```
```javascript
var chai = require('chai');

@@ -36,7 +36,16 @@ require('chai-for-sinon');

Example:
```javascript
expect(stub).to.be.calledOnce();
```
expect(stub.method).to.be.calledOnce();
### calledWith(arg1[, ...])
Assert that the spy/stub/mock function was called with the arguments passed to this function.
Example:
```javascript
expect(stub).to.be.calledWith({foo: 'bar'}, 'baz');
```
### calledWithMatch([arg1[, ...]])
### calledWithMatch(arg1[, ...])

@@ -46,4 +55,13 @@ 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:
```javascript
expect(stub).to.be.calledWithMatch({foo: 'bar'}, 'baz');
```
expect(stub.method).to.be.calledWithMatch({foo: 'bar'}, 'baz');
### thrown()
Assert that the spy/stub/mock threw an exception when it was called.
Example:
```javascript
expect(stub).to.have.thrown();
```

@@ -14,2 +14,14 @@ var chai = require('chai'),

Assertion.addMethod('calledWith', function() {
var obj = this._obj;
new Assertion(obj.calledWith).to.exist;
this.assert(
obj.calledWith.apply(obj, arguments),
'expected #{this} to be called with arguments #{exp}, but got #{act}',
'expected #{this} not to be called with arguments #{exp}, but got #{act}',
arguments,
obj.args
);
});
Assertion.addMethod('calledWithMatch', function() {

@@ -27,2 +39,12 @@ var obj = this._obj;

Assertion.addMethod('thrown', function(arg) {
var obj = this._obj;
new Assertion(obj.threw).to.exist;
this.assert(
obj.threw(arg),
'expected #{this} to have thrown',
'expected #{this} not to have thrown'
);
});
module.exports = chai;
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc