]>
Lady’s Gitweb - Pisces/blob - symbol.test.js
38d74259e7b74f989aec5e331d0bee05848a4c30
1 // ♓🌟 Piscēs ∷ symbol.test.js
2 // ====================================================================
4 // Copyright © 2023 Lady [@ Lady’s Computer].
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/>.
15 } from "./dev-deps.js";
22 describe("getSymbolDescription", () => {
23 it("[[Call]] returns undefined when the symbol has no description", () => {
24 assertStrictEquals(getSymbolDescription(Symbol()), undefined);
27 it("[[Call]] returns the empty string when the symbol has an empty description", () => {
28 assertStrictEquals(getSymbolDescription(Symbol("")), "");
31 it("[[Call]] returns the description", () => {
33 getSymbolDescription(Symbol("etaoin")),
38 it("[[Construct]] throws an error", () => {
39 assertThrows(() => new getSymbolDescription(Symbol()));
42 describe(".name", () => {
43 it("[[Get]] returns the correct name", () => {
45 getSymbolDescription
.name
,
46 "getSymbolDescription",
52 describe("symbolToString", () => {
53 it('[[Call]] returns "Symbol()" when the symbol has no description', () => {
54 assertStrictEquals(symbolToString(Symbol()), "Symbol()");
57 it('[[Call]] returns "Symbol()" when the symbol has an empty description', () => {
58 assertStrictEquals(symbolToString(Symbol("")), "Symbol()");
61 it('[[Call]] returns "Symbol()" wrapping the description', () => {
63 symbolToString(Symbol("etaoin")),
68 it("[[Construct]] throws an error", () => {
69 assertThrows(() => new symbolToString(Symbol()));
72 describe(".name", () => {
73 it("[[Get]] returns the correct name", () => {
82 describe("symbolValue", () => {
83 it("[[Call]] returns the value of a symbol", () => {
84 const symbol
= Symbol();
85 assertStrictEquals(symbolValue(symbol
), symbol
);
88 it("[[Call]] returns the value of a symbol wrapper", () => {
89 const symbol
= Symbol();
90 assertStrictEquals(symbolValue(new Object(symbol
)), symbol
);
93 it("[[Call]] returns the value of a symbol subclass", () => {
94 class SymbolExtension
extends Symbol
{
96 return Object
.setPrototypeOf(
98 SymbolExtension
.prototype,
102 const symbol
= Symbol();
104 symbolValue(new SymbolExtension(symbol
)),
109 it("[[Construct]] throws an error", () => {
110 assertThrows(() => new symbolValue(Symbol()));
113 describe(".name", () => {
114 it("[[Get]] returns the correct name", () => {
This page took 0.053164 seconds and 3 git commands to generate.