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

@@ -3,7 +3,7 @@ import { economyService } from "@shared/modules/economy/economy.service";
import { users, userTimers, transactions } from "@db/schema";
// Define mock functions
const mockFindMany = mock();
const mockFindMany = mock(() => Promise.resolve([]));
const mockFindFirst = mock();
const mockInsert = mock();
const mockUpdate = mock();
@@ -33,6 +33,7 @@ mock.module("@shared/db/DrizzleClient", () => {
query: {
users: { findFirst: mockFindFirst },
userTimers: { findFirst: mockFindFirst },
userQuests: { findMany: mockFindMany },
},
insert: mockInsert,
update: mockUpdate,
@@ -173,7 +174,7 @@ describe("economyService", () => {
it("should throw if cooldown is active", async () => {
const future = new Date("2023-01-02T12:00:00Z"); // +24h
mockFindFirst.mockResolvedValue({ expiresAt: future });
expect(economyService.claimDaily("1")).rejects.toThrow("Daily already claimed");
expect(economyService.claimDaily("1")).rejects.toThrow("You have already claimed your daily reward today");
});
it("should set cooldown to next UTC midnight", async () => {