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
4
fork

Configure Feed

Select the types of activity you want to include in your feed.

test(appview): add theme-policy update path and updatedAt assertions (ATB-57)

Malpercio 00f04ca9 88b14d8f

+24
+24
apps/appview/src/routes/__tests__/admin.test.ts
··· 2989 2989 expect(call.record.defaultLightTheme).toEqual({ theme: { uri: lightUri, cid: "bafylight" } }); 2990 2990 expect(call.record.defaultDarkTheme).toEqual({ theme: { uri: darkUri, cid: "bafydark" } }); 2991 2991 expect(call.record.allowUserChoice).toBe(true); 2992 + expect(typeof call.record.updatedAt).toBe("string"); 2993 + }); 2994 + 2995 + it("overwrites existing policy (upsert) and returns 200 with uri and cid", async () => { 2996 + await ctx.db.insert(themePolicies).values({ 2997 + did: ctx.config.forumDid, 2998 + rkey: "self", 2999 + cid: "bafyexisting", 3000 + defaultLightThemeUri: lightUri, 3001 + defaultDarkThemeUri: darkUri, 3002 + allowUserChoice: false, 3003 + indexedAt: new Date(), 3004 + }); 3005 + 3006 + const res = await app.request("/api/admin/theme-policy", { 3007 + method: "PUT", 3008 + headers: { "Content-Type": "application/json" }, 3009 + body: JSON.stringify(validBody), 3010 + }); 3011 + expect(res.status).toBe(200); 3012 + const body = await res.json(); 3013 + expect(body.uri).toBeDefined(); 3014 + expect(body.cid).toBeDefined(); 3015 + expect(mockPutRecord).toHaveBeenCalledOnce(); 2992 3016 }); 2993 3017 2994 3018 it("defaults allowUserChoice to true when not provided", async () => {