X-Git-Url: https://git.ladys.computer/Pisces/blobdiff_plain/ecf679353a1fb5fde431eca37c70515b64eb3d05..5b8f999fb29590d65fb09cf89c46ad986ef7c377:/string.test.js?ds=sidebyside 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", () => {