diff --git a/src/app/api/documents/inbound/[id]/__tests__/route.test.ts b/src/app/api/documents/inbound/[id]/__tests__/route.test.ts index b19791049..720b4a4a0 100644 --- a/src/app/api/documents/inbound/[id]/__tests__/route.test.ts +++ b/src/app/api/documents/inbound/[id]/__tests__/route.test.ts @@ -115,8 +115,8 @@ describe("PATCH /api/documents/inbound/[id]", () => { expect(res.status).toBe(404); expect(prisma.inboundDocument.update).not.toHaveBeenCalled(); - const where = vi.mocked(prisma.inboundDocument.findFirst).mock.calls[0][0] - .where; + const where = vi.mocked(prisma.inboundDocument.findFirst).mock.calls[0]![0]! + .where!; expect(where.userId).toBe("user-1"); expect(where.deletedAt).toBeNull(); }); diff --git a/src/app/api/documents/inbound/__tests__/route.test.ts b/src/app/api/documents/inbound/__tests__/route.test.ts index c58995afb..f4d17baf0 100644 --- a/src/app/api/documents/inbound/__tests__/route.test.ts +++ b/src/app/api/documents/inbound/__tests__/route.test.ts @@ -130,7 +130,7 @@ describe("POST /api/documents/inbound (store-only)", () => { expect(body.data.title).toBe("Blood panel"); // The row is created with status STORED, no provider, userId from session. - const arg = vi.mocked(prisma.inboundDocument.create).mock.calls[0][0]; + const arg = vi.mocked(prisma.inboundDocument.create).mock.calls[0]![0]!; expect(arg.data.status).toBe("STORED"); expect(arg.data.userId).toBe("user-1"); expect(arg.data.kind).toBe("LAB_RESULT"); @@ -169,11 +169,12 @@ describe("GET /api/documents/inbound (list)", () => { expect(body.data.documents).toHaveLength(2); expect(body.data.nextCursor).toBeNull(); - const arg = vi.mocked(prisma.inboundDocument.findMany).mock.calls[0][0]; - expect(arg.where.userId).toBe("user-1"); - expect(arg.where.deletedAt).toBeNull(); - expect(arg.where.kind).toBe("LAB_RESULT"); - expect(arg.where.OR).toEqual([ + const arg = vi.mocked(prisma.inboundDocument.findMany).mock.calls[0]![0]!; + const where = arg.where!; + expect(where.userId).toBe("user-1"); + expect(where.deletedAt).toBeNull(); + expect(where.kind).toBe("LAB_RESULT"); + expect(where.OR).toEqual([ { title: { contains: "panel", mode: "insensitive" } }, { filename: { contains: "panel", mode: "insensitive" } }, ]);