feat: add business brand assets and health checks

This commit is contained in:
2026-08-17 20:33:04 -04:00
parent 5c9fbe6dc2
commit 7be4bb2abe
36 changed files with 1215 additions and 249 deletions
@@ -0,0 +1,44 @@
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",
);
});
});