From fed27c0227a1faab699be27c66d6b559b4580b5b Mon Sep 17 00:00:00 2001 From: syntaxbullet Date: Sun, 15 Feb 2026 15:20:50 +0100 Subject: [PATCH] fix: mock authentication logic in server test to ensure tests for protected routes pass. --- api/src/server.test.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/api/src/server.test.ts b/api/src/server.test.ts index 1320721..f69d021 100644 --- a/api/src/server.test.ts +++ b/api/src/server.test.ts @@ -66,7 +66,14 @@ mock.module("@shared/lib/config", () => ({ } })); -// 4. Mock BotClient (used by stats helper for maintenanceMode) +// 4. Mock auth (bypass authentication for testing) +mock.module("./routes/auth.routes", () => ({ + authRoutes: { name: "auth", handler: () => null }, + isAuthenticated: () => true, + getSession: () => ({ discordId: "123", username: "testuser", expiresAt: Date.now() + 3600000 }), +})); + +// 5. Mock BotClient (used by stats helper for maintenanceMode) mock.module("../../bot/lib/BotClient", () => ({ AuroraClient: { maintenanceMode: false,