X-Git-Url: https://git.ladys.computer/Pisces/blobdiff_plain/8669d6cba4a0e88ba9fb0e4f9f025bcb417c3cbc..f1667ed7321c6802dc2e96532b0b96eabba4b929:/string.test.js diff --git a/string.test.js b/string.test.js index f70faf6..0af3e32 100644 --- a/string.test.js +++ b/string.test.js @@ -29,6 +29,7 @@ import { splitOnCommas, stripAndCollapseASCIIWhitespace, stripLeadingAndTrailingASCIIWhitespace, + toString, } from "./string.js"; describe("Matcher", () => { @@ -529,3 +530,20 @@ describe("stripLeadingAndTrailingASCIIWhitespace", () => { ); }); }); + +describe("toString", () => { + it("[[Call]] converts to a string", () => { + assertStrictEquals( + toString({ + toString() { + return "success"; + }, + }), + "success", + ); + }); + + it("[[Call]] throws when provided a symbol", () => { + assertThrows(() => toString(Symbol())); + }); +});