Skip to content

Commit fc526a9

Browse files
committed
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.
1 parent 048b977 commit fc526a9

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

test/parallel/test-assert-deep.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -653,16 +653,22 @@ assertDeepAndStrictEqual(-0, -0);
653653

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

656-
assert.throws(() => assert.deepEqual(new Date(), new Date(2000, 3, 14)),
656+
assert.throws(() => { assert.deepEqual(new Date(), new Date(2000, 3, 14)); },
657657
AssertionError,
658658
'deepEqual(new Date(), new Date(2000, 3, 14))');
659659

660660
assert.throws(
661-
() => assert.notDeepEqual(new Date(2000, 3, 14), new Date(2000, 3, 14)),
661+
() => { assert.notDeepEqual(new Date(2000, 3, 14), new Date(2000, 3, 14)); },
662662
AssertionError,
663663
'notDeepEqual(new Date(2000, 3, 14), new Date(2000, 3, 14))'
664664
);
665665

666+
assert.throws(
667+
() => { assert.notDeepEqual('a'.repeat(1024), 'a'.repeat(1024)); },
668+
AssertionError,
669+
'notDeepEqual("a".repeat(1024), "a".repeat(1024))'
670+
);
671+
666672
assert.notDeepEqual(new Date(), new Date(2000, 3, 14));
667673

668674
assertDeepAndStrictEqual(/a/, /a/);

0 commit comments

Comments
 (0)