unexpected
Advanced tools
Comparing version 1.0.12 to 1.0.13
@@ -111,2 +111,8 @@ // Copyright (c) 2013 Sune Simonsen <sune@we-knowhow.dk> | ||
Unexpected.prototype.expect = function (subject, testDescriptionString) { | ||
if (arguments.length < 2) { | ||
throw new Error('The expect functions requires at least two parameters.'); | ||
} | ||
if (typeof testDescriptionString !== 'string') { | ||
throw new Error('The expect functions requires second parameter to be a string.'); | ||
} | ||
var assertionRule = this.assertions[testDescriptionString]; | ||
@@ -113,0 +119,0 @@ if (assertionRule) { |
{ | ||
"name": "unexpected", | ||
"version": "1.0.12", | ||
"version": "1.0.13", | ||
"author": "Sune Sloth Simonsen <sune@we-knowhow.dk>", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -12,2 +12,22 @@ /*global describe, it, expect*/ | ||
describe('unexpected', function () { | ||
describe('argument validation', function () { | ||
it('fails when given no parameters', function () { | ||
expect(function () { | ||
expect(); | ||
}, 'to throw', 'The expect functions requires at least two parameters.'); | ||
}); | ||
it('fails when given only one parameter', function () { | ||
expect(function () { | ||
expect({}); | ||
}, 'to throw', 'The expect functions requires at least two parameters.'); | ||
}); | ||
it('fails when the second parameter is not a string', function () { | ||
expect(function () { | ||
expect({}, {}); | ||
}, 'to throw', 'The expect functions requires second parameter to be a string.'); | ||
}); | ||
}); | ||
describe('ok/truthy/falsy assertion', function () { | ||
@@ -14,0 +34,0 @@ it('assert that the value is truthy or not', function () { |
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
230420
6797