import { describe, expect, it } from "vitest"; import { applyUiBranding, isWorktreeUiBrandingEnabled, renderFaviconLinks } from "../ui-branding.js"; const TEMPLATE = ` `; describe("ui branding", () => { it("detects worktree mode from PAPERCLIP_IN_WORKTREE", () => { expect(isWorktreeUiBrandingEnabled({ PAPERCLIP_IN_WORKTREE: "true" })).toBe(true); expect(isWorktreeUiBrandingEnabled({ PAPERCLIP_IN_WORKTREE: "1" })).toBe(true); expect(isWorktreeUiBrandingEnabled({ PAPERCLIP_IN_WORKTREE: "false" })).toBe(false); }); it("renders the worktree favicon asset set when enabled", () => { const links = renderFaviconLinks(true); expect(links).toContain("/worktree-favicon.ico"); expect(links).toContain("/worktree-favicon.svg"); expect(links).toContain("/worktree-favicon-32x32.png"); expect(links).toContain("/worktree-favicon-16x16.png"); }); it("rewrites the favicon block for worktree instances only", () => { const branded = applyUiBranding(TEMPLATE, { PAPERCLIP_IN_WORKTREE: "true" }); expect(branded).toContain("/worktree-favicon.svg"); expect(branded).not.toContain('href="/favicon.svg"'); const defaultHtml = applyUiBranding(TEMPLATE, {}); expect(defaultHtml).toContain('href="/favicon.svg"'); expect(defaultHtml).not.toContain("/worktree-favicon.svg"); }); });