From ae9afab5a50e5341cce2d44fd1d3b662cdadaa3b Mon Sep 17 00:00:00 2001 From: GroomBook CTO Date: Thu, 19 Mar 2026 10:59:54 +0000 Subject: [PATCH] fix: resolve lint error and test failure for branding feature Co-Authored-By: Claude Opus 4.6 --- apps/web/src/BrandingContext.tsx | 2 +- apps/web/src/__tests__/App.test.tsx | 36 +++++++++++++++++++++++++++++ apps/web/src/pages/Settings.tsx | 2 +- 3 files changed, 38 insertions(+), 2 deletions(-) diff --git a/apps/web/src/BrandingContext.tsx b/apps/web/src/BrandingContext.tsx index 9b8233a..00a761c 100644 --- a/apps/web/src/BrandingContext.tsx +++ b/apps/web/src/BrandingContext.tsx @@ -32,7 +32,7 @@ export function BrandingProvider({ children }: { children: React.ReactNode }) { fetch("/api/branding") .then((r) => (r.ok ? r.json() : null)) .then((data) => { - if (data) setBranding(data); + if (data && typeof data.businessName === "string") setBranding(data); }) .catch(() => {}); }, []); diff --git a/apps/web/src/__tests__/App.test.tsx b/apps/web/src/__tests__/App.test.tsx index 7da9657..97434eb 100644 --- a/apps/web/src/__tests__/App.test.tsx +++ b/apps/web/src/__tests__/App.test.tsx @@ -13,6 +13,18 @@ beforeEach(() => { json: async () => ({ authDisabled: false }), } as Response); } + if (url === "/api/branding") { + return Promise.resolve({ + ok: true, + json: async () => ({ + businessName: "GroomBook", + primaryColor: "#4f8a6f", + accentColor: "#8b7355", + logoBase64: null, + logoMimeType: null, + }), + } as Response); + } return Promise.resolve({ ok: true, json: async () => [], @@ -100,6 +112,18 @@ describe("Dev login selector", () => { }), } as Response); } + if (url === "/api/branding") { + return Promise.resolve({ + ok: true, + json: async () => ({ + businessName: "GroomBook", + primaryColor: "#4f8a6f", + accentColor: "#8b7355", + logoBase64: null, + logoMimeType: null, + }), + } as Response); + } return Promise.resolve({ ok: true, json: async () => [] } as Response); }) as unknown as typeof fetch; @@ -125,6 +149,18 @@ describe("Dev login selector", () => { json: async () => ({ authDisabled: true }), } as Response); } + if (url === "/api/branding") { + return Promise.resolve({ + ok: true, + json: async () => ({ + businessName: "GroomBook", + primaryColor: "#4f8a6f", + accentColor: "#8b7355", + logoBase64: null, + logoMimeType: null, + }), + } as Response); + } return Promise.resolve({ ok: true, json: async () => [] } as Response); }) as unknown as typeof fetch; diff --git a/apps/web/src/pages/Settings.tsx b/apps/web/src/pages/Settings.tsx index d44c2ed..09ff522 100644 --- a/apps/web/src/pages/Settings.tsx +++ b/apps/web/src/pages/Settings.tsx @@ -10,7 +10,7 @@ interface SettingsForm { } export function SettingsPage() { - const { branding, refresh } = useBranding(); + const { refresh } = useBranding(); const [form, setForm] = useState({ businessName: "", primaryColor: "#4f8a6f",