]> Lady’s Gitweb - Pisces/blob - symbol.test.js
Create symbol.js module with getSymbolDescription
[Pisces] / symbol.test.js
1 // ♓🌟 Piscēs ∷ symbol.test.js
2 // ====================================================================
3 //
4 // Copyright © 2023 Lady [@ Lady’s Computer].
5 //
6 // This Source Code Form is subject to the terms of the Mozilla Public
7 // License, v. 2.0. If a copy of the MPL was not distributed with this
8 // file, You can obtain one at <https://mozilla.org/MPL/2.0/>.
9
10 import {
11 assertStrictEquals,
12 assertThrows,
13 describe,
14 it,
15 } from "./dev-deps.js";
16 import { getSymbolDescription } from "./symbol.js";
17
18 describe("getSymbolDescription", () => {
19 it("[[Call]] returns undefined when the symbol has no description", () => {
20 assertStrictEquals(getSymbolDescription(Symbol()), undefined);
21 });
22
23 it("[[Call]] returns the empty string when the symbol has an empty description", () => {
24 assertStrictEquals(getSymbolDescription(Symbol("")), "");
25 });
26
27 it("[[Call]] returns the description", () => {
28 assertStrictEquals(
29 getSymbolDescription(Symbol("etaoin")),
30 "etaoin",
31 );
32 });
33
34 it("[[Call]] returns the empty string when the symbol has an empty description", () => {
35 assertStrictEquals(getSymbolDescription(Symbol("")), "");
36 });
37
38 it("[[Construct]] throws an error", () => {
39 assertThrows(() => new getSymbolDescription(Symbol()));
40 });
41
42 describe(".name", () => {
43 it("[[Get]] returns the correct name", () => {
44 assertStrictEquals(
45 getSymbolDescription.name,
46 "getSymbolDescription",
47 );
48 });
49 });
50 });
This page took 0.160265 seconds and 5 git commands to generate.