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(appview): add ForumAgent not authenticated test for POST /api/admin/boards (ATB-45)

+18
+18
apps/appview/src/routes/__tests__/admin.test.ts
··· 1621 1621 expect(data.error).toContain("Forum agent not available"); 1622 1622 }); 1623 1623 1624 + it("returns 503 when ForumAgent not authenticated", async () => { 1625 + const originalAgent = ctx.forumAgent; 1626 + ctx.forumAgent = { getAgent: () => null } as any; 1627 + 1628 + const res = await app.request("/api/admin/boards", { 1629 + method: "POST", 1630 + headers: { "Content-Type": "application/json" }, 1631 + body: JSON.stringify({ name: "Test", categoryUri }), 1632 + }); 1633 + 1634 + expect(res.status).toBe(503); 1635 + const data = await res.json(); 1636 + expect(data.error).toBe("Forum agent not authenticated. Please try again later."); 1637 + expect(mockPutRecord).not.toHaveBeenCalled(); 1638 + 1639 + ctx.forumAgent = originalAgent; 1640 + }); 1641 + 1624 1642 it("returns 403 when user lacks manageCategories permission", async () => { 1625 1643 const { requirePermission } = await import("../../middleware/permissions.js"); 1626 1644 const mockRequirePermission = requirePermission as any;