diff options
Diffstat (limited to 'test/js')
-rw-r--r-- | test/js/bun/test/expect.test.ts | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/test/js/bun/test/expect.test.ts b/test/js/bun/test/expect.test.ts index 9a70aca0a..756e8aaca 100644 --- a/test/js/bun/test/expect.test.ts +++ b/test/js/bun/test/expect.test.ts @@ -45,4 +45,37 @@ describe("expect()", () => { test(label, () => expect(value).toBeInstanceOf(instanceOf)); } }); + + describe("toMatch()", () => { + const tests = [ + { + label: "reguler expression", + value: "123", + matched: /123/, + }, + { + label: "reguler expression object", + value: "123", + matched: new RegExp("123"), + }, + { + label: "substring", + value: "123", + matched: "12", + }, + { + label: "substring emojis", + value: "ππ", + matched: "π" + }, + { + label: "substring UTF-16", + value: "π π π π π π
π π€£ π₯² βΊοΈ π π π", + matched: "π₯² βΊοΈ π" + }, + ]; + for (const { label, value, matched } of tests) { + test(label, () => expect(value).toMatch(matched)); + } + }); }); |