fix(dash): resolve test regressions, await promises, and improve TypeScript strictness

This commit is contained in:
syntaxbullet
2026-01-08 21:12:41 +01:00
parent 8253de9f73
commit 3f3a6c88e8
4 changed files with 78 additions and 31 deletions

View File

@@ -8,10 +8,10 @@ const mockSelect = mock(() => ({
const mockQuery = {
transactions: {
findMany: mock(() => Promise.resolve([])),
findMany: mock((): Promise<any[]> => Promise.resolve([])),
},
moderationCases: {
findMany: mock(() => Promise.resolve([])),
findMany: mock((): Promise<any[]> => Promise.resolve([])),
},
};
@@ -133,7 +133,7 @@ describe("dashboardService", () => {
createdAt: now,
user: { username: "user1" },
},
] as any);
] as unknown as any[]);
mockQuery.moderationCases.findMany.mockResolvedValueOnce([
{
@@ -142,7 +142,7 @@ describe("dashboardService", () => {
reason: "Test",
createdAt: earlier,
},
] as any);
] as unknown as any[]);
const events = await dashboardService.getRecentEvents(10);
@@ -156,7 +156,7 @@ describe("dashboardService", () => {
describe("recordEvent", () => {
test("should emit NEW_EVENT to systemEvents", async () => {
const mockEmit = mock((_event: string, _data: any) => { });
const mockEmit = mock((_event: string, _data: unknown) => { });
mock.module("@shared/lib/events", () => ({
systemEvents: {

View File

@@ -63,7 +63,7 @@ export const economyService = {
// Record dashboard event
const { dashboardService } = await import("@shared/modules/dashboard/dashboard.service");
dashboardService.recordEvent({
await dashboardService.recordEvent({
type: 'info',
message: `${sender.username} transferred ${amount.toLocaleString()} AU to User ID ${toUserId}`,
icon: '💸'
@@ -159,7 +159,7 @@ export const economyService = {
// Record dashboard event
const { dashboardService } = await import("@shared/modules/dashboard/dashboard.service");
dashboardService.recordEvent({
await dashboardService.recordEvent({
type: 'success',
message: `${user.username} claimed daily reward: ${totalReward.toLocaleString()} AU`,
icon: '☀️'