Comparing version 3.0.0 to 3.1.0
{ | ||
"name": "chai", | ||
"version": "3.0.0", | ||
"description": "BDD/TDD assertion library for node.js and the browser. Test framework agnostic.", | ||
@@ -5,0 +4,0 @@ "license": "MIT", |
@@ -14,3 +14,3 @@ /*! | ||
exports.version = '3.0.0'; | ||
exports.version = '3.1.0'; | ||
@@ -17,0 +17,0 @@ /*! |
@@ -335,2 +335,21 @@ /*! | ||
/** | ||
* ### .NaN | ||
* Asserts that the target is `NaN`. | ||
* | ||
* expect('foo').to.be.NaN; | ||
* expect(4).not.to.be.NaN; | ||
* | ||
* @name NaN | ||
* @api public | ||
*/ | ||
Assertion.addProperty('NaN', function () { | ||
this.assert( | ||
isNaN(flag(this, 'object')) | ||
, 'expected #{this} to be NaN' | ||
, 'expected #{this} not to be NaN' | ||
); | ||
}); | ||
/** | ||
* ### .exist | ||
@@ -1622,2 +1641,83 @@ * | ||
/** | ||
* ### .extensible | ||
* | ||
* Asserts that the target is extensible (can have new properties added to | ||
* it). | ||
* | ||
* var nonExtensibleObject = Object.preventExtensions({}); | ||
* var sealedObject = Object.seal({}); | ||
* var frozenObject = Object.freeze({}); | ||
* | ||
* expect({}).to.be.extensible; | ||
* expect(nonExtensibleObject).to.not.be.extensible; | ||
* expect(sealedObject).to.not.be.extensible; | ||
* expect(frozenObject).to.not.be.extensible; | ||
* | ||
* @name extensible | ||
* @api public | ||
*/ | ||
Assertion.addProperty('extensible', function() { | ||
var obj = flag(this, 'object'); | ||
this.assert( | ||
Object.isExtensible(obj) | ||
, 'expected #{this} to be extensible' | ||
, 'expected #{this} to not be extensible' | ||
); | ||
}); | ||
/** | ||
* ### .sealed | ||
* | ||
* Asserts that the target is sealed (cannot have new properties added to it | ||
* and its existing properties cannot be removed). | ||
* | ||
* var sealedObject = Object.seal({}); | ||
* var frozenObject = Object.freeze({}); | ||
* | ||
* expect(sealedObject).to.be.sealed; | ||
* expect(frozenObject).to.be.sealed; | ||
* expect({}).to.not.be.sealed; | ||
* | ||
* @name sealed | ||
* @api public | ||
*/ | ||
Assertion.addProperty('sealed', function() { | ||
var obj = flag(this, 'object'); | ||
this.assert( | ||
Object.isSealed(obj) | ||
, 'expected #{this} to be sealed' | ||
, 'expected #{this} to not be sealed' | ||
); | ||
}); | ||
/** | ||
* ### .frozen | ||
* | ||
* Asserts that the target is frozen (cannot have new properties added to it | ||
* and its existing properties cannot be modified). | ||
* | ||
* var frozenObject = Object.freeze({}); | ||
* | ||
* expect(frozenObject).to.be.frozen; | ||
* expect({}).to.not.be.frozen; | ||
* | ||
* @name frozen | ||
* @api public | ||
*/ | ||
Assertion.addProperty('frozen', function() { | ||
var obj = flag(this, 'object'); | ||
this.assert( | ||
Object.isSealed(obj) | ||
, 'expected #{this} to be frozen' | ||
, 'expected #{this} to not be frozen' | ||
); | ||
}); | ||
}; |
@@ -334,2 +334,33 @@ /*! | ||
/** | ||
* ### .isNaN | ||
* Asserts that value is NaN | ||
* | ||
* assert.isNaN('foo', 'foo is NaN'); | ||
* | ||
* @name isNaN | ||
* @param {Mixed} value | ||
* @param {String} message | ||
* @api public | ||
*/ | ||
assert.isNaN = function (val, msg) { | ||
new Assertion(val, msg).to.be.NaN; | ||
}; | ||
/** | ||
* ### .isNotNaN | ||
* Asserts that value is not NaN | ||
* | ||
* assert.isNotNaN(4, '4 is not NaN'); | ||
* | ||
* @name isNotNaN | ||
* @param {Mixed} value | ||
* @param {String} message | ||
* @api public | ||
*/ | ||
assert.isNotNaN = function (val, msg) { | ||
new Assertion(val, msg).not.to.be.NaN; | ||
}; | ||
/** | ||
* ### .isUndefined(value, [message]) | ||
@@ -1267,2 +1298,117 @@ * | ||
/** | ||
* ### .extensible(object) | ||
* | ||
* Asserts that `object` is extensible (can have new properties added to it). | ||
* | ||
* assert.extensible({}); | ||
* | ||
* @name extensible | ||
* @param {Object} object | ||
* @param {String} message _optional_ | ||
* @api public | ||
*/ | ||
assert.extensible = function (obj, msg) { | ||
new Assertion(obj, msg).to.be.extensible; | ||
}; | ||
/** | ||
* ### .notExtensible(object) | ||
* | ||
* Asserts that `object` is _not_ extensible. | ||
* | ||
* var nonExtensibleObject = Object.preventExtensions({}); | ||
* var sealedObject = Object.seal({}); | ||
* var frozenObject = Object.freese({}); | ||
* | ||
* assert.notExtensible(nonExtensibleObject); | ||
* assert.notExtensible(sealedObject); | ||
* assert.notExtensible(frozenObject); | ||
* | ||
* @name notExtensible | ||
* @param {Object} object | ||
* @param {String} message _optional_ | ||
* @api public | ||
*/ | ||
assert.notExtensible = function (obj, msg) { | ||
new Assertion(obj, msg).to.not.be.extensible; | ||
}; | ||
/** | ||
* ### .sealed(object) | ||
* | ||
* Asserts that `object` is sealed (cannot have new properties added to it | ||
* and its existing properties cannot be removed). | ||
* | ||
* var sealedObject = Object.seal({}); | ||
* var frozenObject = Object.seal({}); | ||
* | ||
* assert.sealed(sealedObject); | ||
* assert.sealed(frozenObject); | ||
* | ||
* @name sealed | ||
* @param {Object} object | ||
* @param {String} message _optional_ | ||
* @api public | ||
*/ | ||
assert.sealed = function (obj, msg) { | ||
new Assertion(obj, msg).to.be.sealed; | ||
}; | ||
/** | ||
* ### .notSealed(object) | ||
* | ||
* Asserts that `object` is _not_ sealed. | ||
* | ||
* assert.notSealed({}); | ||
* | ||
* @name notSealed | ||
* @param {Object} object | ||
* @param {String} message _optional_ | ||
* @api public | ||
*/ | ||
assert.notSealed = function (obj, msg) { | ||
new Assertion(obj, msg).to.not.be.sealed; | ||
}; | ||
/** | ||
* ### .frozen(object) | ||
* | ||
* Asserts that `object` is frozen (cannot have new properties added to it | ||
* and its existing properties cannot be modified). | ||
* | ||
* var frozenObject = Object.freeze({}); | ||
* assert.frozen(frozenObject); | ||
* | ||
* @name frozen | ||
* @param {Object} object | ||
* @param {String} message _optional_ | ||
* @api public | ||
*/ | ||
assert.frozen = function (obj, msg) { | ||
new Assertion(obj, msg).to.be.frozen; | ||
}; | ||
/** | ||
* ### .notFrozen(object) | ||
* | ||
* Asserts that `object` is _not_ frozen. | ||
* | ||
* assert.notFrozen({}); | ||
* | ||
* @name notSealed | ||
* @param {Object} object | ||
* @param {String} message _optional_ | ||
* @api public | ||
*/ | ||
assert.notFrozen = function (obj, msg) { | ||
new Assertion(obj, msg).to.not.be.frozen; | ||
}; | ||
/*! | ||
@@ -1269,0 +1415,0 @@ * Aliases. |
@@ -20,3 +20,3 @@ { | ||
], | ||
"version": "3.0.0", | ||
"version": "3.1.0", | ||
"repository": { | ||
@@ -23,0 +23,0 @@ "type": "git", |
Sorry, the diff of this file is too big to display
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
357710
9440