sinon-chai
Advanced tools
Comparing version 1.2.2 to 1.3.0
@@ -1,6 +0,1 @@ | ||
/*jshint | ||
curly: true, eqeqeq: true, immed: true, latedef: true, newcap: true, noarg: true, nonew: true, trailing: true, | ||
undef: true, white: true, es5: true, strict: true, node: true */ | ||
/*global define: false */ | ||
(function (sinonChai) { | ||
@@ -56,2 +51,14 @@ "use strict"; | ||
function isSpy(putativeSpy) { | ||
return typeof putativeSpy === "function" && | ||
typeof putativeSpy.getCall === "function" && | ||
typeof putativeSpy.calledWithExactly === "function"; | ||
} | ||
function assertIsAboutSpy(assertion) { | ||
if (!isSpy(assertion.obj)) { | ||
throw new TypeError(chai.inspect(assertion.obj) + " is not a spy!"); | ||
} | ||
} | ||
function getMessages(spy, action, nonNegatedSuffix, always, args) { | ||
@@ -73,2 +80,4 @@ var verbPhrase = always ? "always have " : "have "; | ||
property(name, function () { | ||
assertIsAboutSpy(this); | ||
var messages = getMessages(this.obj, action, nonNegatedSuffix, false); | ||
@@ -81,2 +90,4 @@ this.assert(this.obj[name], messages.affirmative, messages.negative); | ||
method(chaiName, function () { | ||
assertIsAboutSpy(this); | ||
var alwaysSinonMethod = "always" + sinonName[0].toUpperCase() + sinonName.substring(1); | ||
@@ -83,0 +94,0 @@ var shouldBeAlways = this._always && typeof this.obj[alwaysSinonMethod] === "function"; |
@@ -12,3 +12,3 @@ { | ||
], | ||
"version": "1.2.2", | ||
"version": "1.3.0", | ||
"author": "Domenic Denicola <domenic@domenicdenicola.com> (http://domenicdenicola.com)", | ||
@@ -28,3 +28,4 @@ "repository": { | ||
"test": "mocha", | ||
"lint": "jshint ./lib --show-non-errors" | ||
"lint": "jshint ./lib --show-non-errors", | ||
"cover": "cover run node_modules/mocha/bin/_mocha && cover report html && start ./cover_html/index.html" | ||
}, | ||
@@ -40,5 +41,6 @@ "engines": { | ||
"mocha": "1", | ||
"chai": ">=0.3.3 <=0.5", | ||
"chai": "~0.5", | ||
"cover": "*", | ||
"jshint": "*" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
42449
16
109
5