Files
bun.sh/test/js/node/assert/assert-doesNotMatch.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
546 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 \"actual\" 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");
});