X-Git-Url: https://git.ladys.computer/Pisces/blobdiff_plain/f0ab8cc83ab12f8d8b995358e3953e96be3d5918..83f6aae0d1b8181dc2b0c6ccdba9f2fe2fdba3e6:/string.test.js diff --git a/string.test.js b/string.test.js index 6407d94..e3d1096 100644 --- a/string.test.js +++ b/string.test.js @@ -1,7 +1,7 @@ // ♓🌟 Piscēs ∷ string.test.js // ==================================================================== // -// Copyright © 2022 Lady [@ Lady’s Computer]. +// Copyright © 2022–2023 Lady [@ Lady’s Computer]. // // This Source Code Form is subject to the terms of the Mozilla Public // License, v. 2.0. If a copy of the MPL was not distributed with this @@ -10,7 +10,6 @@ import { assert, assertEquals, - assertSpyCall, assertSpyCalls, assertStrictEquals, assertThrows, @@ -101,11 +100,12 @@ describe("Matcher", () => { return "etaoin"; }, }); + assertEquals([...result], ["etaoin", "e"]); assertSpyCalls(constraint, 1); - assertSpyCall(constraint, 0, { - args: ["etaoin", result, matcher], - self: undefined, - }); + assertStrictEquals(constraint.calls[0].args[0], "etaoin"); + assertEquals([...constraint.calls[0].args[1]], ["etaoin", "e"]); + assertStrictEquals(constraint.calls[0].args[2], matcher); + assertStrictEquals(constraint.calls[0].self, undefined); }); it("[[Call]] does not call the constraint if the match fails", () => { @@ -184,6 +184,12 @@ describe("Matcher", () => { }); }); + describe("::toString", () => { + it("[[Get]] does not throw an error", () => { + new Matcher(/(?:)/u).toString(); + }); + }); + describe("::unicode", () => { it("[[Get]] returns true when the unicode flag is present", () => { assertStrictEquals(new Matcher(/(?:)/u).unicode, true); @@ -207,10 +213,10 @@ describe("Matcher", () => { const matcher = new Matcher("(.).*", undefined, constraint); matcher("etaoin"); assertSpyCalls(constraint, 1); - assertEquals(constraint.calls[0].args[0], "etaoin"); + assertStrictEquals(constraint.calls[0].args[0], "etaoin"); assertEquals([...constraint.calls[0].args[1]], ["etaoin", "e"]); - assertEquals(constraint.calls[0].args[2], matcher); - assertEquals(constraint.calls[0].self, undefined); + assertStrictEquals(constraint.calls[0].args[2], matcher); + assertStrictEquals(constraint.calls[0].self, undefined); }); it("[[Call]] does not call the constraint if the match fails", () => {