fix: mock authentication logic in server test to ensure tests for protected routes pass.

This commit is contained in:
syntaxbullet
2026-02-15 15:20:50 +01:00
parent 9751e62e30
commit fed27c0227

View File

@@ -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,