]> Lady’s Gitweb - Pisces/commitdiff
Use strict equals in Matcher constraint tests
authorLady <redacted>
Sat, 20 May 2023 01:05:27 +0000 (18:05 -0700)
committerLady <redacted>
Sat, 20 May 2023 01:05:27 +0000 (18:05 -0700)
Otherwise Deno will see Matcher is a RegExp and cast to a string.

string.test.js

index 6407d9415b2aa469006e517db5fc66adbd2c93e7..94aec3701c30abfb4bb2298c739cfd6bc11496de 100644 (file)
@@ -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
@@ -102,10 +102,10 @@ describe("Matcher", () => {
         },
       });
       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", () => {
@@ -207,10 +207,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", () => {
This page took 0.028785 seconds and 4 git commands to generate.