X-Git-Url: https://git.ladys.computer/Pisces/blobdiff_plain/ecf679353a1fb5fde431eca37c70515b64eb3d05..fb3e0d562e2dbe9e3ea911a80bfdabc8851f92b2:/string.test.js?ds=inline diff --git a/string.test.js b/string.test.js index 52e848c..6407d94 100644 --- a/string.test.js +++ b/string.test.js @@ -95,15 +95,15 @@ describe("Matcher", () => { it("[[Call]] calls the constraint if the match succeeds", () => { const constraint = spy((_) => true); - const matcher = new Matcher(".*", undefined, constraint); - matcher.exec({ + const matcher = new Matcher("(.).*", undefined, constraint); + const result = matcher.exec({ toString() { return "etaoin"; }, }); assertSpyCalls(constraint, 1); assertSpyCall(constraint, 0, { - args: ["etaoin", matcher], + args: ["etaoin", result, matcher], self: undefined, }); }); @@ -204,13 +204,13 @@ describe("Matcher", () => { it("[[Call]] calls the constraint if the match succeeds", () => { const constraint = spy((_) => true); - const matcher = new Matcher(".*", undefined, constraint); + const matcher = new Matcher("(.).*", undefined, constraint); matcher("etaoin"); assertSpyCalls(constraint, 1); - assertSpyCall(constraint, 0, { - args: ["etaoin", matcher], - self: undefined, - }); + assertEquals(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); }); it("[[Call]] does not call the constraint if the match fails", () => {