import { describe, expect, it } from "vitest"; import { resolveRequiredToolcraftAppIdentity } from "./app-identity"; describe("resolveRequiredToolcraftAppIdentity", () => { it("normalizes an explicit app identity", () => { const identity = resolveRequiredToolcraftAppIdentity({ id: " My Visual Tool ", title: "My Visual Tool", }); expect(identity).toEqual({ id: "my-visual-tool", title: "My Visual Tool", }); expect(Object.isFrozen(identity)).toBe(true); }); it.each(["", "!!!", "🔥"])( "rejects an explicit normalization-empty id %j", (id) => { expect(() => resolveRequiredToolcraftAppIdentity({ id, title: "Explicit Title" }), ).toThrow(/canonical ASCII id/); }, ); it("rejects a blank explicit title", () => { expect(() => resolveRequiredToolcraftAppIdentity({ id: "product", title: " " }), ).toThrow(/non-whitespace text/); }); });