Skip to content

Commit 875057d

Browse files
committed
test: add assert.deepOwnInclude and assert.notDeepOwnInclude
1 parent 889b489 commit 875057d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

test/assert.js

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -824,6 +824,28 @@ describe('assert', function () {
824824
}, "expected { a: 1 } to not have own property 'a' of 1");
825825
});
826826

827+
it('deepOwnInclude and notDeepOwnInclude', function() {
828+
assert.deepOwnInclude({a: {b: 2}}, {a: {b: 2}});
829+
assert.notDeepOwnInclude({a: {b: 2}}, {a: {c: 3}});
830+
assert.notDeepOwnInclude({a: {b: 2}}, {'toString': Object.prototype.toString});
831+
832+
err(function () {
833+
assert.deepOwnInclude({a: {b: 2}}, {a: {c: 3}}, 'blah');
834+
}, "blah: expected { a: { b: 2 } } to have deep own property 'a' of { c: 3 }, but got { b: 2 }");
835+
836+
err(function () {
837+
assert.deepOwnInclude({a: {b: 2}}, 'blah', {a: {c: 3}});
838+
}, "blah: expected { a: { b: 2 } } to have deep own property 'a' of { c: 3 }, but got { b: 2 }");
839+
840+
err(function () {
841+
assert.deepOwnInclude({a: {b: 2}}, {'toString': Object.prototype.toString});
842+
}, "expected { a: { b: 2 } } to have deep own property 'toString'");
843+
844+
err(function () {
845+
assert.notDeepOwnInclude({a: {b: 2}}, {a: {b: 2}});
846+
}, "expected { a: { b: 2 } } to not have deep own property 'a' of { b: 2 }");
847+
});
848+
827849
it('keys(array|Object|arguments)', function(){
828850
assert.hasAllKeys({ foo: 1 }, [ 'foo' ]);
829851
assert.hasAllKeys({ foo: 1, bar: 2 }, [ 'foo', 'bar' ]);

0 commit comments

Comments
 (0)