mirror of
https://github.com/chaijs/chai
synced 2024-11-14 15:57:10 +00:00
test: add assert.ownInclude and assert.notOwnInclude
This commit is contained in:
parent
479e4c46de
commit
a5691d32c5
1 changed files with 24 additions and 0 deletions
|
@ -775,6 +775,30 @@ describe('assert', function () {
|
|||
}, "expected { a: { b: [ 'x', 'y' ] } } to not have nested property 'a.b[1]' of 'y'");
|
||||
});
|
||||
|
||||
it('ownInclude and notOwnInclude', function() {
|
||||
assert.ownInclude({a: 1}, {a: 1});
|
||||
assert.notOwnInclude({a: 1}, {a: 3});
|
||||
assert.notOwnInclude({a: 1}, {'toString': Object.prototype.toString});
|
||||
|
||||
assert.notOwnInclude({a: {b: 2}}, {a: {b: 2}});
|
||||
|
||||
err(function () {
|
||||
assert.ownInclude({a: 1}, {a: 3}, 'blah');
|
||||
}, "blah: expected { a: 1 } to have own property 'a' of 3, but got 1");
|
||||
|
||||
err(function () {
|
||||
assert.ownInclude({a: 1}, 'blah', {a: 3});
|
||||
}, "blah: expected { a: 1 } to have own property 'a' of 3, but got 1");
|
||||
|
||||
err(function () {
|
||||
assert.ownInclude({a: 1}, {'toString': Object.prototype.toString});
|
||||
}, "expected { a: 1 } to have own property 'toString'");
|
||||
|
||||
err(function () {
|
||||
assert.notOwnInclude({a: 1}, {a: 1});
|
||||
}, "expected { a: 1 } to not have own property 'a' of 1");
|
||||
});
|
||||
|
||||
it('keys(array|Object|arguments)', function(){
|
||||
assert.hasAllKeys({ foo: 1 }, [ 'foo' ]);
|
||||
assert.hasAllKeys({ foo: 1, bar: 2 }, [ 'foo', 'bar' ]);
|
||||
|
|
Loading…
Reference in a new issue