import { describe, expect, test } from "bun:test"; import { hasBusinessBrandAsset, resolveBusinessBrandAsset, } from "../src/brand-assets"; import { businessBrandAssetPath } from "../../../apps/web/src/lib/business-branding"; describe("business brand assets", () => { test("prefers the requested kind and theme", () => { const asset = resolveBusinessBrandAsset( { logoStorageKey: "logo-light", logoMimeType: "image/png", iconDarkStorageKey: "icon-dark", iconDarkMimeType: "image/svg+xml", }, "icon", "dark", ); expect(asset).toEqual({ storageKey: "icon-dark", mimeType: "image/svg+xml", }); }); test("falls back to the legacy combined light logo", () => { const business = { logoStorageKey: "legacy-logo", logoMimeType: "image/jpeg", }; expect(hasBusinessBrandAsset(business)).toBe(true); expect(resolveBusinessBrandAsset(business, "wordmark", "dark")).toEqual({ storageKey: "legacy-logo", mimeType: "image/jpeg", }); }); test("builds a role and theme-aware public URL", () => { expect(businessBrandAssetPath("abc", "icon", "dark", "png")).toBe( "/api/business-logo/abc?kind=icon&theme=dark&format=png", ); }); });