import { describe, expect, it } from "vitest"; import { assertPageIcon } from "./page-icon.js"; describe("page icon validation", () => { it.each([ { type: "custom_emoji", id: "workspace-emoji" }, { type: "file", resourceId: "icon-file" }, { type: "url", url: "https://example.com/icon.png" }, null, "🚀", ])("rejects unsupported icon input %j", (icon) => { expect(() => assertPageIcon(icon)).toThrow("standard emoji or a Notion icon"); }); it.each(["", " "])("rejects an empty Notion icon description %j", (description) => { expect(() => assertPageIcon({ type: "notion_icon", description })).toThrow( "nonempty description", ); }); it("rejects an unsupported Notion icon color", () => { expect(() => assertPageIcon({ type: "notion_icon", description: "rocket", color: "rainbow" }), ).toThrow("Notion page icon colors"); }); });