Files
bun.sh/test/js/node/assert/assert-match.test.cjs
Markus Ekholm 9a0dadad24 feat: implemented assert.doesNotMatch (#8008)
* implemented assert.doesNotMatch

* fixed assert.match and assert.doesNotMatch tests and ensure it throws when actual is not a string

---------

Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
2024-01-08 17:31:54 -08:00

14 lines
493 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 \"actual\" 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");
});