Skip to content
Permalink
Browse files

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.

PR-URL: #26065
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
  • Loading branch information...
Trott committed Feb 13, 2019
1 parent fe58bef commit 8e68dc53b3526f46455c5b094cd8c08e87e22df1
Showing with 8 additions and 2 deletions.
  1. +8 −2 test/parallel/test-assert-deep.js
@@ -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/);

0 comments on commit 8e68dc5

Please sign in to comment.
You can’t perform that action at this time.