X-Git-Url: https://git.ladys.computer/Pisces/blobdiff_plain/8e591ec68a18c0c4cc355bcde45747546ed59cd9..ee0f6916f2f56f17bd232f964fec9a4c7ed6ec89:/symbol.test.js?ds=sidebyside diff --git a/symbol.test.js b/symbol.test.js new file mode 100644 index 0000000..bedcc72 --- /dev/null +++ b/symbol.test.js @@ -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 . + +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", + ); + }); + }); +});