mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-13 14:32:03 +00:00
test: give the report's pulse-window count a mock and a typed route call
This commit is contained in:
1 parent
0e991c3640
commit
3458100ac4
2 files changed
+5
-2
No files matched your search
@@ -19,7 +19,8 @@ import { unzipSync } from "fflate";
|
||||
|
||||
vi.mock("@/lib/db", () => ({
|
||||
prisma: {
|
||||
measurement: { findMany: vi.fn() },
|
||||
// `count` sizes the report's pulse window (#1023): a sparse account.
|
||||
measurement: { findMany: vi.fn(), count: vi.fn(async () => 0) },
|
||||
medication: { findMany: vi.fn() },
|
||||
medicationIntakeEvent: { findMany: vi.fn() },
|
||||
moodEntry: { findMany: vi.fn() },
|
||||
|
||||
@@ -147,7 +147,9 @@ describe("resting-pulse proxy folded in Postgres", () => {
|
||||
const spy = vi.spyOn(prisma.measurement, "findMany");
|
||||
try {
|
||||
const { GET } = await import("@/app/api/insights/comprehensive/route");
|
||||
const res = await GET(
|
||||
// The route reads no request field, so its handler is typed without one.
|
||||
const callGet = GET as unknown as (req: NextRequest) => Promise<Response>;
|
||||
const res = await callGet(
|
||||
new NextRequest("http://localhost/api/insights/comprehensive"),
|
||||
);
|
||||
expect(res.status).toBe(200);
|
||||
|
||||
Reference in new issue
Block a user