Skip to content

Commit

Permalink
test: add assert.deepOwnInclude and assert.notDeepOwnInclude
Browse files Browse the repository at this point in the history
  • Loading branch information
zetamorph committed May 4, 2017
1 parent 889b489 commit 875057d
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions test/assert.js
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,28 @@ describe('assert', function () {
}, "expected { a: 1 } to not have own property 'a' of 1");
});

it('deepOwnInclude and notDeepOwnInclude', function() {
assert.deepOwnInclude({a: {b: 2}}, {a: {b: 2}});
assert.notDeepOwnInclude({a: {b: 2}}, {a: {c: 3}});
assert.notDeepOwnInclude({a: {b: 2}}, {'toString': Object.prototype.toString});

err(function () {
assert.deepOwnInclude({a: {b: 2}}, {a: {c: 3}}, 'blah');
}, "blah: expected { a: { b: 2 } } to have deep own property 'a' of { c: 3 }, but got { b: 2 }");

err(function () {
assert.deepOwnInclude({a: {b: 2}}, 'blah', {a: {c: 3}});
}, "blah: expected { a: { b: 2 } } to have deep own property 'a' of { c: 3 }, but got { b: 2 }");

err(function () {
assert.deepOwnInclude({a: {b: 2}}, {'toString': Object.prototype.toString});
}, "expected { a: { b: 2 } } to have deep own property 'toString'");

err(function () {
assert.notDeepOwnInclude({a: {b: 2}}, {a: {b: 2}});
}, "expected { a: { b: 2 } } to not have deep own property 'a' of { b: 2 }");
});

it('keys(array|Object|arguments)', function(){
assert.hasAllKeys({ foo: 1 }, [ 'foo' ]);
assert.hasAllKeys({ foo: 1, bar: 2 }, [ 'foo', 'bar' ]);
Expand Down

0 comments on commit 875057d

Please sign in to comment.