]> Lady’s Gitweb - Pisces/blobdiff - symbol.test.js
Create symbol.js module with getSymbolDescription
[Pisces] / symbol.test.js
diff --git a/symbol.test.js b/symbol.test.js
new file mode 100644 (file)
index 0000000..bedcc72
--- /dev/null
@@ -0,0 +1,50 @@
+// ♓🌟 Piscēs ∷ symbol.test.js
+// ====================================================================
+//
+// Copyright © 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
+// file, You can obtain one at <https://mozilla.org/MPL/2.0/>.
+
+import {
+  assertStrictEquals,
+  assertThrows,
+  describe,
+  it,
+} from "./dev-deps.js";
+import { getSymbolDescription } from "./symbol.js";
+
+describe("getSymbolDescription", () => {
+  it("[[Call]] returns undefined when the symbol has no description", () => {
+    assertStrictEquals(getSymbolDescription(Symbol()), undefined);
+  });
+
+  it("[[Call]] returns the empty string when the symbol has an empty description", () => {
+    assertStrictEquals(getSymbolDescription(Symbol("")), "");
+  });
+
+  it("[[Call]] returns the description", () => {
+    assertStrictEquals(
+      getSymbolDescription(Symbol("etaoin")),
+      "etaoin",
+    );
+  });
+
+  it("[[Call]] returns the empty string when the symbol has an empty description", () => {
+    assertStrictEquals(getSymbolDescription(Symbol("")), "");
+  });
+
+  it("[[Construct]] throws an error", () => {
+    assertThrows(() => new getSymbolDescription(Symbol()));
+  });
+
+  describe(".name", () => {
+    it("[[Get]] returns the correct name", () => {
+      assertStrictEquals(
+        getSymbolDescription.name,
+        "getSymbolDescription",
+      );
+    });
+  });
+});
This page took 0.195375 seconds and 4 git commands to generate.