fix: resolve lint error and test failure for branding feature
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -32,7 +32,7 @@ export function BrandingProvider({ children }: { children: React.ReactNode }) {
|
|||||||
fetch("/api/branding")
|
fetch("/api/branding")
|
||||||
.then((r) => (r.ok ? r.json() : null))
|
.then((r) => (r.ok ? r.json() : null))
|
||||||
.then((data) => {
|
.then((data) => {
|
||||||
if (data) setBranding(data);
|
if (data && typeof data.businessName === "string") setBranding(data);
|
||||||
})
|
})
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
}, []);
|
}, []);
|
||||||
|
|||||||
@@ -13,6 +13,18 @@ beforeEach(() => {
|
|||||||
json: async () => ({ authDisabled: false }),
|
json: async () => ({ authDisabled: false }),
|
||||||
} as Response);
|
} 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({
|
return Promise.resolve({
|
||||||
ok: true,
|
ok: true,
|
||||||
json: async () => [],
|
json: async () => [],
|
||||||
@@ -100,6 +112,18 @@ describe("Dev login selector", () => {
|
|||||||
}),
|
}),
|
||||||
} as Response);
|
} 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);
|
return Promise.resolve({ ok: true, json: async () => [] } as Response);
|
||||||
}) as unknown as typeof fetch;
|
}) as unknown as typeof fetch;
|
||||||
|
|
||||||
@@ -125,6 +149,18 @@ describe("Dev login selector", () => {
|
|||||||
json: async () => ({ authDisabled: true }),
|
json: async () => ({ authDisabled: true }),
|
||||||
} as Response);
|
} 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);
|
return Promise.resolve({ ok: true, json: async () => [] } as Response);
|
||||||
}) as unknown as typeof fetch;
|
}) as unknown as typeof fetch;
|
||||||
|
|
||||||
|
|||||||
@@ -10,7 +10,7 @@ interface SettingsForm {
|
|||||||
}
|
}
|
||||||
|
|
||||||
export function SettingsPage() {
|
export function SettingsPage() {
|
||||||
const { branding, refresh } = useBranding();
|
const { refresh } = useBranding();
|
||||||
const [form, setForm] = useState<SettingsForm>({
|
const [form, setForm] = useState<SettingsForm>({
|
||||||
businessName: "",
|
businessName: "",
|
||||||
primaryColor: "#4f8a6f",
|
primaryColor: "#4f8a6f",
|
||||||
|
|||||||
Reference in New Issue
Block a user