]> Lady’s Gitweb - Pisces/blobdiff - string.test.js
Add toString to string.js
[Pisces] / string.test.js
index f70faf6be0b569a7e23ab22c483a6c34f7a44400..0af3e323f0c252f79f8bcfa64c59b5379352fb13 100644 (file)
@@ -29,6 +29,7 @@ import {
   splitOnCommas,
   stripAndCollapseASCIIWhitespace,
   stripLeadingAndTrailingASCIIWhitespace,
+  toString,
 } from "./string.js";
 
 describe("Matcher", () => {
@@ -529,3 +530,20 @@ describe("stripLeadingAndTrailingASCIIWhitespace", () => {
     );
   });
 });
+
+describe("toString", () => {
+  it("[[Call]] converts to a string", () => {
+    assertStrictEquals(
+      toString({
+        toString() {
+          return "success";
+        },
+      }),
+      "success",
+    );
+  });
+
+  it("[[Call]] throws when provided a symbol", () => {
+    assertThrows(() => toString(Symbol()));
+  });
+});
This page took 0.053916 seconds and 4 git commands to generate.