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.

fix(appview): add 503 ForumAgent-not-authenticated tests; fix Bruno error code docs (ATB-57)

Malpercio 4b9bb7c2 f8327479

+66 -4
+58
apps/appview/src/routes/__tests__/admin.test.ts
··· 2580 2580 expect(body.error).toContain("Forum agent not available"); 2581 2581 }); 2582 2582 2583 + it("returns 503 when ForumAgent not authenticated", async () => { 2584 + const originalAgent = ctx.forumAgent; 2585 + ctx.forumAgent = { getAgent: () => null } as any; 2586 + const res = await app.request("/api/admin/themes", { 2587 + method: "POST", 2588 + headers: { "Content-Type": "application/json" }, 2589 + body: JSON.stringify({ name: "Test", colorScheme: "light", tokens: {} }), 2590 + }); 2591 + expect(res.status).toBe(503); 2592 + const body = await res.json(); 2593 + expect(body.error).toBe("Forum agent not authenticated. Please try again later."); 2594 + expect(mockPutRecord).not.toHaveBeenCalled(); 2595 + ctx.forumAgent = originalAgent; 2596 + }); 2597 + 2583 2598 it("returns 401 when not authenticated", async () => { 2584 2599 mockUser = null; 2585 2600 const res = await app.request("/api/admin/themes", { ··· 2798 2813 }); 2799 2814 }); 2800 2815 2816 + it("returns 503 when ForumAgent not authenticated", async () => { 2817 + const originalAgent = ctx.forumAgent; 2818 + ctx.forumAgent = { getAgent: () => null } as any; 2819 + const res = await app.request(`/api/admin/themes/${TEST_RKEY}`, { 2820 + method: "PUT", 2821 + headers: { "Content-Type": "application/json" }, 2822 + body: JSON.stringify({ name: "Updated", colorScheme: "light", tokens: {} }), 2823 + }); 2824 + expect(res.status).toBe(503); 2825 + const body = await res.json(); 2826 + expect(body.error).toBe("Forum agent not authenticated. Please try again later."); 2827 + expect(mockPutRecord).not.toHaveBeenCalled(); 2828 + ctx.forumAgent = originalAgent; 2829 + }); 2830 + 2801 2831 it("returns 503 when PDS write fails with a network error", async () => { 2802 2832 mockPutRecord.mockRejectedValueOnce(new Error("fetch failed")); 2803 2833 const res = await app.request(`/api/admin/themes/${TEST_RKEY}`, { ··· 2937 2967 mockRequirePermission.mockImplementation(() => async (_c: any, next: any) => { 2938 2968 await next(); 2939 2969 }); 2970 + }); 2971 + 2972 + it("returns 503 when ForumAgent not authenticated", async () => { 2973 + const originalAgent = ctx.forumAgent; 2974 + ctx.forumAgent = { getAgent: () => null } as any; 2975 + const res = await app.request(`/api/admin/themes/${themeRkey}`, { 2976 + method: "DELETE", 2977 + }); 2978 + expect(res.status).toBe(503); 2979 + const body = await res.json(); 2980 + expect(body.error).toBe("Forum agent not authenticated. Please try again later."); 2981 + expect(mockDeleteRecord).not.toHaveBeenCalled(); 2982 + ctx.forumAgent = originalAgent; 2940 2983 }); 2941 2984 2942 2985 it("returns 503 when PDS delete fails with a network error", async () => { ··· 3162 3205 expect(res.status).toBe(500); 3163 3206 const body = await res.json(); 3164 3207 expect(body.error).toContain("Forum agent not available"); 3208 + }); 3209 + 3210 + it("returns 503 when ForumAgent not authenticated", async () => { 3211 + const originalAgent = ctx.forumAgent; 3212 + ctx.forumAgent = { getAgent: () => null } as any; 3213 + const res = await app.request("/api/admin/theme-policy", { 3214 + method: "PUT", 3215 + headers: { "Content-Type": "application/json" }, 3216 + body: JSON.stringify(validBody), 3217 + }); 3218 + expect(res.status).toBe(503); 3219 + const body = await res.json(); 3220 + expect(body.error).toBe("Forum agent not authenticated. Please try again later."); 3221 + expect(mockPutRecord).not.toHaveBeenCalled(); 3222 + ctx.forumAgent = originalAgent; 3165 3223 }); 3166 3224 }); 3167 3225
+2 -1
bruno/AppView API/Admin Themes/Create Theme.bru
··· 50 50 - 400: Missing name/colorScheme/tokens, invalid colorScheme, non-HTTPS fontUrl, token value not a string, malformed JSON 51 51 - 401: Not authenticated 52 52 - 403: Missing manageThemes permission 53 - - 503: ForumAgent not configured or PDS network error 53 + - 500: ForumAgent not configured (server configuration issue) 54 + - 503: ForumAgent not authenticated or PDS network error 54 55 }
+2 -1
bruno/AppView API/Admin Themes/Delete Theme.bru
··· 32 32 - 403: Missing manageThemes permission 33 33 - 404: Theme not found 34 34 - 409: Theme is the current defaultLightTheme or defaultDarkTheme — update theme policy first 35 - - 503: ForumAgent not configured or PDS network error 35 + - 500: ForumAgent not configured (server configuration issue) 36 + - 503: ForumAgent not authenticated or PDS network error 36 37 }
+2 -1
bruno/AppView API/Admin Themes/Update Theme Policy.bru
··· 52 52 default URI not in availableThemes list, malformed JSON 53 53 - 401: Not authenticated 54 54 - 403: Missing manageThemes permission 55 - - 503: ForumAgent not configured or PDS network error 55 + - 500: ForumAgent not configured (server configuration issue) 56 + - 503: ForumAgent not authenticated or PDS network error 56 57 }
+2 -1
bruno/AppView API/Admin Themes/Update Theme.bru
··· 49 49 - 401: Not authenticated 50 50 - 403: Missing manageThemes permission 51 51 - 404: Theme not found 52 - - 503: ForumAgent not configured or PDS network error 52 + - 500: ForumAgent not configured (server configuration issue) 53 + - 503: ForumAgent not authenticated or PDS network error 53 54 }