unexpected-sinon
Advanced tools
Comparing version
@@ -34,40 +34,40 @@ // Copyright (c) 2013 Sune Simonsen <sune@we-knowhow.dk> | ||
return function (expect) { | ||
expect.addAssertion('was [not] called', function () { | ||
expect.addAssertion('was [not] called', function (expect, subject) { | ||
if (this.flags.not) { | ||
sinon.assert.notCalled(this.obj); | ||
sinon.assert.notCalled(subject); | ||
} else { | ||
sinon.assert.called(this.obj); | ||
sinon.assert.called(subject); | ||
} | ||
}); | ||
expect.addAssertion('was called once', function () { | ||
sinon.assert.calledOnce(this.obj); | ||
expect.addAssertion('was called once', function (expect, subject) { | ||
sinon.assert.calledOnce(subject); | ||
}); | ||
expect.addAssertion('was called twice', function () { | ||
sinon.assert.calledTwice(this.obj); | ||
expect.addAssertion('was called twice', function (expect, subject) { | ||
sinon.assert.calledTwice(subject); | ||
}); | ||
expect.addAssertion('was called thrice', function () { | ||
sinon.assert.calledThrice(this.obj); | ||
expect.addAssertion('was called thrice', function (expect, subject) { | ||
sinon.assert.calledThrice(subject); | ||
}); | ||
expect.addAssertion('was called times', function (times) { | ||
sinon.assert.callCount(this.obj, times); | ||
expect.addAssertion('was called times', function (expect, subject, times) { | ||
sinon.assert.callCount(subject, times); | ||
}); | ||
expect.addAssertion('given call order', function () { | ||
sinon.assert.callOrder.apply(null, this.obj); | ||
expect.addAssertion('given call order', function (expect, subject) { | ||
sinon.assert.callOrder.apply(null, subject); | ||
}); | ||
expect.addAssertion('was [always] called on', function (target) { | ||
expect.addAssertion('was [always] called on', function (expect, subject, target) { | ||
if (this.flags.always) { | ||
sinon.assert.alwaysCalledOn(this.obj, target); | ||
sinon.assert.alwaysCalledOn(subject, target); | ||
} else { | ||
sinon.assert.calledOn(this.obj, target); | ||
sinon.assert.calledOn(subject, target); | ||
} | ||
}); | ||
expect.addAssertion('was [always] called with [exactly]', function () { | ||
var args = [this.obj].concat(Array.prototype.slice.call(arguments)); | ||
expect.addAssertion('was [always] called with [exactly]', function (expect, subject) { | ||
var args = [subject].concat(Array.prototype.slice.call(arguments, 2)); | ||
if (this.flags.always && this.flags.exactly) { | ||
@@ -84,12 +84,12 @@ sinon.assert.alwaysCalledWithExactly.apply(null, args); | ||
expect.addAssertion('was never called with', function () { | ||
var args = [this.obj].concat(Array.prototype.slice.call(arguments)); | ||
expect.addAssertion('was never called with', function (expect, subject) { | ||
var args = [subject].concat(Array.prototype.slice.call(arguments, 2)); | ||
sinon.assert.neverCalledWith.apply(null, args); | ||
}); | ||
expect.addAssertion('[always] threw', function (value) { | ||
expect.addAssertion('[always] threw', function (expect, subject, value) { | ||
if (this.flags.always) { | ||
sinon.assert.alwaysThrew(this.obj, value); | ||
sinon.assert.alwaysThrew(subject, value); | ||
} else { | ||
sinon.assert.threw(this.obj, value); | ||
sinon.assert.threw(subject, value); | ||
} | ||
@@ -96,0 +96,0 @@ }); |
{ | ||
"name": "unexpected-sinon", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"author": "Sune Sloth Simonsen <sune@we-knowhow.dk>", | ||
@@ -23,6 +23,7 @@ "keywords": [ | ||
"main": "./lib/unexpected-sinon.js", | ||
"dependencies": { | ||
"peerDependencies": { | ||
"sinon": "*" | ||
}, | ||
"devDependencies": { | ||
"sinon": "~1.9.1", | ||
"unexpected": ">=1.1.2", | ||
@@ -29,0 +30,0 @@ "mocha": "~1.9.0", |
Wildcard dependency
QualityPackage has a dependency with a floating version range. This can cause issues if the dependency publishes a new major version.
Found 1 instance in 1 package
141255
0.12%0
-100%5
25%- Removed