From ed266e8571d1efdbb4ece0a01f849cbc57461076 Mon Sep 17 00:00:00 2001 From: Erik Vold Date: Fri, 30 Jun 2017 22:55:56 -0700 Subject: [PATCH] [Tests] add tests for `Object.create(null)` --- test/cmp.js | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/test/cmp.js b/test/cmp.js index fd0ada6..bfe03c8 100644 --- a/test/cmp.js +++ b/test/cmp.js @@ -33,6 +33,7 @@ test('strict equal', function (t) { test('non-objects', function (t) { t.ok(equal(3, 3)); + t.ok(equal(3, 3, { strict: true })); t.ok(equal('beep', 'beep')); t.ok(equal('3', 3)); t.notOk(equal('3', 3, { strict: true })); @@ -229,7 +230,7 @@ test('zeroes', function (t) { t.end(); }); -test('test objects', { skip: !Object.create }, function (t) { +test('Object.create', { skip: !Object.create }, function (t) { var a = { a: 'A' }; var b = Object.create(a); b.b = 'B'; @@ -245,6 +246,16 @@ test('test objects', { skip: !Object.create }, function (t) { t.end(); }); +test('Object.create(null)', { skip: !Object.create }, function (t) { + t.ok(equal(Object.create(null), Object.create(null)), 'two empty null objects are deep equal'); + t.ok(equal(Object.create(null), Object.create(null), { strict: true }), 'strict: two empty null objects are deep equal'); + + t.ok(equal(Object.create(null, { a: { value: 'b' } }), Object.create(null, { a: { value: 'b' } })), 'two null objects are deep equal'); + t.ok(equal(Object.create(null, { a: { value: 'b' } }), Object.create(null, { a: { value: 'b' } }), { strict: true }), 'strict: two null objects are deep equal'); + + t.end(); +}); + test('regexes vs dates', function (t) { var d = new Date(1387585278000); var r = /abc/;