Files
bun.sh/test/js/node/assert/assert-match.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

16 lines
500 B
JavaScript

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