Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
test: increase coverage for assertion_error.js
Add a test for long strings and assert.notDeepEqual() to cover code that
truncates output when it is longer than 1024 characters.
  • Loading branch information
Trott committed Feb 13, 2019
commit fc526a942a978a85095461e1506e26ac3c4e22aa
10 changes: 8 additions & 2 deletions test/parallel/test-assert-deep.js
Original file line number Diff line number Diff line change
Expand Up @@ -653,16 +653,22 @@ assertDeepAndStrictEqual(-0, -0);

assert.deepEqual(new Date(2000, 3, 14), new Date(2000, 3, 14));

assert.throws(() => assert.deepEqual(new Date(), new Date(2000, 3, 14)),
assert.throws(() => { assert.deepEqual(new Date(), new Date(2000, 3, 14)); },
AssertionError,
'deepEqual(new Date(), new Date(2000, 3, 14))');

assert.throws(
() => assert.notDeepEqual(new Date(2000, 3, 14), new Date(2000, 3, 14)),
() => { assert.notDeepEqual(new Date(2000, 3, 14), new Date(2000, 3, 14)); },
AssertionError,
'notDeepEqual(new Date(2000, 3, 14), new Date(2000, 3, 14))'
);

assert.throws(
() => { assert.notDeepEqual('a'.repeat(1024), 'a'.repeat(1024)); },
AssertionError,
'notDeepEqual("a".repeat(1024), "a".repeat(1024))'
);

assert.notDeepEqual(new Date(), new Date(2000, 3, 14));

assertDeepAndStrictEqual(/a/, /a/);
Expand Down