WIP! A BB-style forum, on the ATmosphere! We're still working... we'll be back soon when we have something to show off!
node typescript hono htmx atproto

test(web): add missing resolveTheme branch test for malformed theme URI (ATB-53)

+10
+10
apps/web/src/lib/__tests__/theme-resolution.test.ts
··· 146 146 expect(result.tokens).toEqual(FALLBACK_THEME.tokens); 147 147 }); 148 148 149 + it("returns FALLBACK_THEME when defaultLightThemeUri is malformed (parseRkeyFromUri returns null)", async () => { 150 + mockFetch.mockResolvedValueOnce( 151 + policyResponse({ defaultLightThemeUri: "malformed-uri" }) 152 + ); 153 + const result = await resolveTheme(APPVIEW, undefined, undefined); 154 + expect(result.tokens).toEqual(FALLBACK_THEME.tokens); 155 + // Only one fetch should happen (policy only — no theme fetch) 156 + expect(mockFetch).toHaveBeenCalledTimes(1); 157 + }); 158 + 149 159 it("returns FALLBACK_THEME when theme fetch fails", async () => { 150 160 mockFetch 151 161 .mockResolvedValueOnce(policyResponse())