diff --git a/src/app/api/insights/coach/nudge-status/__tests__/route.test.ts b/src/app/api/insights/coach/nudge-status/__tests__/route.test.ts index 06b273b0d..cb3b24c75 100644 --- a/src/app/api/insights/coach/nudge-status/__tests__/route.test.ts +++ b/src/app/api/insights/coach/nudge-status/__tests__/route.test.ts @@ -52,8 +52,9 @@ describe("nudge-status — NEXT_APP_OPEN hook", () => { await (GET as unknown as () => Promise)(); expect(evaluateContext).toHaveBeenCalledTimes(1); - const [prismaArg, userId, trigger] = evaluateContext.mock.calls[0]!; - expect((prismaArg as { __tag: string }).__tag).toBe("prisma"); + const [prismaArg, userId, trigger] = evaluateContext.mock + .calls[0] as unknown as [{ __tag: string }, string, string]; + expect(prismaArg.__tag).toBe("prisma"); expect(userId).toBe("u1"); expect(trigger).toBe("app-open"); // Ordering: the surfaced message must be visible to this very read. diff --git a/src/lib/ai/coach/__tests__/context-reminders.test.ts b/src/lib/ai/coach/__tests__/context-reminders.test.ts index 8772b6a8d..dfccf9437 100644 --- a/src/lib/ai/coach/__tests__/context-reminders.test.ts +++ b/src/lib/ai/coach/__tests__/context-reminders.test.ts @@ -137,9 +137,11 @@ describe("evaluateCoachContextReminders — measurement cues", () => { "measurement", NOW, ); - const where = prisma.coachReminder.findMany.mock.calls[0]![0]!.where as { - contextCue: { in: string[] }; - }; + const where = ( + prisma.coachReminder.findMany.mock.calls[0] as unknown as [ + { where: { contextCue: { in: string[] } } }, + ] + )[0].where; expect(where.contextCue.in).not.toContain("NEXT_APP_OPEN"); }); }); diff --git a/src/lib/jobs/__tests__/coach-reminder-sweep.test.ts b/src/lib/jobs/__tests__/coach-reminder-sweep.test.ts index 4927ce4b2..d9b45d0d2 100644 --- a/src/lib/jobs/__tests__/coach-reminder-sweep.test.ts +++ b/src/lib/jobs/__tests__/coach-reminder-sweep.test.ts @@ -21,10 +21,12 @@ vi.mock("@/lib/ai/coach/bytes-codec", () => ({ // The context-cue backstop delegates to the shared evaluator; its own // behaviour is pinned in `ai/coach/__tests__/context-reminders.test.ts`. -const contextEvaluateMock = vi.fn(async () => ({ surfaced: 0, errored: 0 })); +const contextEvaluateMock = vi.fn(async (..._args: unknown[]) => ({ + surfaced: 0, + errored: 0, +})); vi.mock("@/lib/ai/coach/context-reminders", () => ({ - evaluateCoachContextReminders: (...args: unknown[]) => - contextEvaluateMock(...args), + evaluateCoachContextReminders: contextEvaluateMock, })); import { runCoachReminderSweep } from "../coach-reminder-sweep"; diff --git a/src/lib/jobs/__tests__/reminder-satisfy.test.ts b/src/lib/jobs/__tests__/reminder-satisfy.test.ts index 403389196..77a9e35b7 100644 --- a/src/lib/jobs/__tests__/reminder-satisfy.test.ts +++ b/src/lib/jobs/__tests__/reminder-satisfy.test.ts @@ -21,10 +21,12 @@ vi.mock("@/lib/jobs/boss-instance", () => ({ // the Vorsorge assertions stay isolated; one test below pins that the hook // actually fires (watched red: removing the call site in // `runReminderSatisfyForUser` fails it). -const evaluateContextMock = vi.fn(async () => ({ surfaced: 0, errored: 0 })); +const evaluateContextMock = vi.fn(async (..._args: unknown[]) => ({ + surfaced: 0, + errored: 0, +})); vi.mock("@/lib/ai/coach/context-reminders", () => ({ - evaluateCoachContextReminders: (...args: unknown[]) => - evaluateContextMock(...args), + evaluateCoachContextReminders: evaluateContextMock, })); import {