]>
Lady’s Gitweb - Pisces/blob - symbol.test.js
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(".length", () => {
43 it("[[Get]] returns the correct length", () => {
44 assertStrictEquals(getSymbolDescription
.length
, 1);
48 describe(".name", () => {
49 it("[[Get]] returns the correct name", () => {
51 getSymbolDescription
.name
,
52 "getSymbolDescription",
58 describe("symbolToString", () => {
59 it('[[Call]] returns "Symbol()" when the symbol has no description', () => {
60 assertStrictEquals(symbolToString(Symbol()), "Symbol()");
63 it('[[Call]] returns "Symbol()" when the symbol has an empty description', () => {
64 assertStrictEquals(symbolToString(Symbol("")), "Symbol()");
67 it('[[Call]] returns "Symbol()" wrapping the description', () => {
69 symbolToString(Symbol("etaoin")),
74 it("[[Construct]] throws an error", () => {
75 assertThrows(() => new symbolToString(Symbol()));
78 describe(".length", () => {
79 it("[[Get]] returns the correct length", () => {
80 assertStrictEquals(symbolToString
.length
, 1);
84 describe(".name", () => {
85 it("[[Get]] returns the correct name", () => {
94 describe("symbolValue", () => {
95 it("[[Call]] returns the value of a symbol", () => {
96 const symbol
= Symbol();
97 assertStrictEquals(symbolValue(symbol
), symbol
);
100 it("[[Call]] returns the value of a symbol wrapper", () => {
101 const symbol
= Symbol();
102 assertStrictEquals(symbolValue(new Object(symbol
)), symbol
);
105 it("[[Call]] returns the value of a symbol subclass", () => {
106 class SymbolExtension
extends Symbol
{
107 constructor(symbol
) {
108 return Object
.setPrototypeOf(
110 SymbolExtension
.prototype,
114 const symbol
= Symbol();
116 symbolValue(new SymbolExtension(symbol
)),
121 it("[[Construct]] throws an error", () => {
122 assertThrows(() => new symbolValue(Symbol()));
125 describe(".length", () => {
126 it("[[Get]] returns the correct length", () => {
127 assertStrictEquals(symbolValue
.length
, 1);
131 describe(".name", () => {
132 it("[[Get]] returns the correct name", () => {
This page took 0.102968 seconds and 5 git commands to generate.