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

sinon-chai

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

sinon-chai - npm Package Compare versions

Comparing version 2.4.0 to 2.5.0

17

lib/sinon-chai.js

@@ -29,2 +29,9 @@ (function (sinonChai) {

function timesInWords(count) {
return count === 1 ? "once" :
count === 2 ? "twice" :
count === 3 ? "thrice" :
(count || 0) + " times";
}
function isCall(putativeCall) {

@@ -66,2 +73,11 @@ return putativeCall && isSpy(putativeCall.proxy);

function sinonPropertyAsBooleanMethod(name, action, nonNegatedSuffix) {
utils.addMethod(chai.Assertion.prototype, name, function (arg) {
assertCanWorkWith(this);
var messages = getMessages(this._obj, action, nonNegatedSuffix, false, [timesInWords(arg)]);
this.assert(this._obj[name] === arg, messages.affirmative, messages.negative);
});
}
function createSinonMethodHandler(sinonName, action, nonNegatedSuffix) {

@@ -99,2 +115,3 @@ return function () {

sinonProperty("called", "been called", " at least once, but it was never called");
sinonPropertyAsBooleanMethod("callCount", "been called exactly %1", ", but it was called %c%C");
sinonProperty("calledOnce", "been called exactly once", ", but it was called %c%C");

@@ -101,0 +118,0 @@ sinonProperty("calledTwice", "been called exactly twice", ", but it was called %c%C");

2

LICENSE.txt
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright © 2012–2013 Domenic Denicola <domenic@domenicdenicola.com>
Copyright © 2012–2014 Domenic Denicola <domenic@domenicdenicola.com>

@@ -6,0 +6,0 @@ Everyone is permitted to copy and distribute verbatim or modified

@@ -12,4 +12,4 @@ {

],
"version": "2.4.0",
"author": "Domenic Denicola <domenic@domenicdenicola.com> (http://domenicdenicola.com)",
"version": "2.5.0",
"author": "Domenic Denicola <domenic@domenicdenicola.com> (http://domenic.me)",
"license": "WTFPL",

@@ -20,8 +20,3 @@ "repository": {

},
"bugs": {
"url": "http://github.com/domenic/sinon-chai/issues"
},
"directories": {
"lib": "./lib"
},
"bugs": "http://github.com/domenic/sinon-chai/issues",
"main": "./lib/sinon-chai.js",

@@ -38,10 +33,10 @@ "scripts": {

"devDependencies": {
"chai": "~1.5",
"coffee-script": "~1.6.2",
"cover": "~0.2.8",
"jshint": "~1.1",
"mocha": "~1.9",
"chai": "~1.8",
"coffee-script": "~1.6",
"cover": "~0.2.9",
"jshint": "~2.4",
"mocha": "~1.17",
"opener": "~1.3",
"sinon": "~1.6"
"sinon": "~1.7"
}
}

@@ -32,86 +32,94 @@ # Sinon.JS Assertions for Chai

<table>
<tr>
<th>Sinon.JS property/method</th>
<th>Sinon–Chai assertion</th>
</tr>
<tr>
<td>called</td>
<td>spy.should.have.been.called</td>
</tr>
<tr>
<td>calledOnce</td>
<td>spy.should.have.been.calledOnce</td>
</tr>
<tr>
<td>calledTwice</td>
<td>spy.should.have.been.calledTwice</td>
</tr>
<tr>
<td>calledThrice</td>
<td>spy.should.have.been.calledThrice</td>
</tr>
<tr>
<td>calledBefore</td>
<td>spy1.should.have.been.calledBefore(spy2)</td>
</tr>
<tr>
<td>calledAfter</td>
<td>spy1.should.have.been.calledAfter(spy2)</td>
</tr>
<tr>
<td>calledWithNew</td>
<td>spy.should.have.been.calledWithNew</td>
</tr>
<tr>
<td>alwaysCalledWithNew</td>
<td>spy.should.always.have.been.calledWithNew</td>
</tr>
<tr>
<td>calledOn</td>
<td>spy.should.have.been.calledOn(context)</td>
</tr>
<tr>
<td>alwaysCalledOn</td>
<td>spy.should.always.have.been.calledOn(context)</td>
</tr>
<tr>
<td>calledWith</td>
<td>spy.should.have.been.calledWith(...args)</td>
</tr>
<tr>
<td>alwaysCalledWith</td>
<td>spy.should.always.have.been.calledWith(...args)</td>
</tr>
<tr>
<td>calledWithExactly</td>
<td>spy.should.always.have.been.calledWithExactly(...args)</td>
</tr>
<tr>
<td>alwaysCalledWithExactly</td>
<td>spy.should.always.have.been.calledWithExactly(...args)</td>
</tr>
<tr>
<td>calledWithMatch</td>
<td>spy.should.have.been.calledWithMatch(...args)</td>
</tr>
<tr>
<td>alwaysCalledWithMatch</td>
<td>spy.should.always.have.been.calledWithMatch(...args)</td>
</tr>
<tr>
<td>returned</td>
<td>spy.should.have.returned(returnVal)</td>
</tr>
<tr>
<td>alwaysReturned</td>
<td>spy.should.have.always.returned(returnVal)</td>
</tr>
<tr>
<td>threw</td>
<td>spy.should.have.thrown(errorObjOrErrorTypeStringOrNothing)</td>
</tr>
<tr>
<td>alwaysThrew</td>
<td>spy.should.have.always.thrown(errorObjOrErrorTypeStringOrNothing)</td>
</tr>
<thead>
<tr>
<th>Sinon.JS property/method</th>
<th>Sinon–Chai assertion</th>
</tr>
</thead>
<tbody>
<tr>
<td>called</td>
<td>spy.should.have.been.called</td>
</tr>
<tr>
<td>callCount</td>
<td>spy.should.have.callCount(n)</td>
</tr>
<tr>
<td>calledOnce</td>
<td>spy.should.have.been.calledOnce</td>
</tr>
<tr>
<td>calledTwice</td>
<td>spy.should.have.been.calledTwice</td>
</tr>
<tr>
<td>calledThrice</td>
<td>spy.should.have.been.calledThrice</td>
</tr>
<tr>
<td>calledBefore</td>
<td>spy1.should.have.been.calledBefore(spy2)</td>
</tr>
<tr>
<td>calledAfter</td>
<td>spy1.should.have.been.calledAfter(spy2)</td>
</tr>
<tr>
<td>calledWithNew</td>
<td>spy.should.have.been.calledWithNew</td>
</tr>
<tr>
<td>alwaysCalledWithNew</td>
<td>spy.should.always.have.been.calledWithNew</td>
</tr>
<tr>
<td>calledOn</td>
<td>spy.should.have.been.calledOn(context)</td>
</tr>
<tr>
<td>alwaysCalledOn</td>
<td>spy.should.always.have.been.calledOn(context)</td>
</tr>
<tr>
<td>calledWith</td>
<td>spy.should.have.been.calledWith(...args)</td>
</tr>
<tr>
<td>alwaysCalledWith</td>
<td>spy.should.always.have.been.calledWith(...args)</td>
</tr>
<tr>
<td>calledWithExactly</td>
<td>spy.should.have.been.calledWithExactly(...args)</td>
</tr>
<tr>
<td>alwaysCalledWithExactly</td>
<td>spy.should.always.have.been.calledWithExactly(...args)</td>
</tr>
<tr>
<td>calledWithMatch</td>
<td>spy.should.have.been.calledWithMatch(...args)</td>
</tr>
<tr>
<td>alwaysCalledWithMatch</td>
<td>spy.should.always.have.been.calledWithMatch(...args)</td>
</tr>
<tr>
<td>returned</td>
<td>spy.should.have.returned(returnVal)</td>
</tr>
<tr>
<td>alwaysReturned</td>
<td>spy.should.have.always.returned(returnVal)</td>
</tr>
<tr>
<td>threw</td>
<td>spy.should.have.thrown(errorObjOrErrorTypeStringOrNothing)</td>
</tr>
<tr>
<td>alwaysThrew</td>
<td>spy.should.have.always.thrown(errorObjOrErrorTypeStringOrNothing)</td>
</tr>
</tbody>
</table>

@@ -118,0 +126,0 @@

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