Files
bun.sh/test/js/node/assert/assert-doesNotMatch.test.cjs
Don Isaac 0372ca5c0a test(node): get test-assert.js working (#15698)
Co-authored-by: Don Isaac <don@bun.sh>
Co-authored-by: DonIsaac <DonIsaac@users.noreply.github.com>
2025-01-10 00:45:43 +00:00

18 lines
562 B
JavaScript

var assert = require("assert");
test("doesNotMatch does not throw when not matching", () => {
assert.doesNotMatch("I will pass", /different/);
});
test("doesNotMatch throws when argument is not string", () => {
expect(() => assert.doesNotMatch(123, /pass/)).toThrow(
'The "string" argument must be of type string. Received type number',
);
});
test("doesNotMatch throws when matching", () => {
expect(() => assert.doesNotMatch("I will fail", /fail/, "doesNotMatch throws when matching")).toThrow(
"doesNotMatch throws when matching",
);
});