Skip to content

Commit 67d2b7b

Browse files
committed
fixup! add more tests
1 parent 7dea1a2 commit 67d2b7b

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/parallel/test-assert.js

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1737,6 +1737,24 @@ test('Ambiguous error messages fail', () => {
17371737
);
17381738
});
17391739

1740+
test('Faulty message functions', () => {
1741+
assert.throws(
1742+
() => assert.doesNotMatch('foo', /foo/, (a, b) => 123),
1743+
{
1744+
code: 'ERR_ASSERTION',
1745+
message: "'foo' doesNotMatch /foo/"
1746+
}
1747+
);
1748+
1749+
assert.throws(
1750+
() => assert.match('foo', /123/, (a, b) => { new Error('baz'); }),
1751+
{
1752+
code: 'ERR_ASSERTION',
1753+
message: "'foo' match /123/"
1754+
}
1755+
);
1756+
});
1757+
17401758
test('Functions as error message', () => {
17411759
function errorMessage(actual, expected) {
17421760
return `Nice message including ${actual} and ${expected}`;

0 commit comments

Comments
 (0)