chore: Enhance database debugging setup and expand test mocks for Drizzle queries and Discord API interactions.
Some checks failed
Deploy to Production / test (push) Failing after 29s
Deploy to Production / build (push) Has been skipped
Deploy to Production / deploy (push) Has been skipped

This commit is contained in:
syntaxbullet
2026-01-30 16:12:15 +01:00
parent 7049cbfd9d
commit 9a2fc101da
10 changed files with 43 additions and 13 deletions

View File

@@ -7,6 +7,8 @@ const mockLimit = mock();
// Helper to support the chained calls in getLeaderboards
const mockChain = {
from: () => mockChain,
leftJoin: () => mockChain,
groupBy: () => mockChain,
orderBy: () => mockChain,
limit: mockLimit
};
@@ -75,7 +77,8 @@ describe("dashboardService", () => {
// First call is topLevels, second is topWealth
mockLimit
.mockResolvedValueOnce(mockTopLevels)
.mockResolvedValueOnce(mockTopWealth);
.mockResolvedValueOnce(mockTopWealth)
.mockResolvedValueOnce(mockTopWealth); // Mock net worth same as wealth for simplicity
const result = await dashboardService.getLeaderboards();
@@ -85,7 +88,7 @@ describe("dashboardService", () => {
expect(result.topWealth[0]!.balance).toBe("1000");
expect(result.topWealth[0]!.username).toBe("Alice");
expect(result.topWealth[1]!.balance).toBe("500");
expect(mockLimit).toHaveBeenCalledTimes(2);
expect(mockLimit).toHaveBeenCalledTimes(3);
});
test("should handle empty leaderboards", async () => {