From 0b973f4f7672f28f444b62d1c718807b22314f2a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Wed, 8 Jul 2026 21:41:49 +0200 Subject: [PATCH] test(documents): mock content-index lookup and pair new animations with motion-reduce The PATCH detail route now reads the content-index provenance, so its route test mocks documentContentIndex.findUnique; the searchable status spinner and the Read-with-AI pulse pair with motion-reduce:animate-none per the coverage guard. --- src/app/api/documents/inbound/[id]/__tests__/route.test.ts | 6 ++++++ src/components/documents/document-ai-panels.tsx | 5 ++++- src/components/documents/document-ai-section.tsx | 5 ++++- 3 files changed, 14 insertions(+), 2 deletions(-) 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 1f1ee72f9..3c5a5d443 100644 --- a/src/app/api/documents/inbound/[id]/__tests__/route.test.ts +++ b/src/app/api/documents/inbound/[id]/__tests__/route.test.ts @@ -22,6 +22,9 @@ vi.mock("@/lib/db", () => ({ deleteMany: vi.fn(), createMany: vi.fn(), }, + documentContentIndex: { + findUnique: vi.fn(), + }, illnessEpisode: { findMany: vi.fn(), }, @@ -131,6 +134,9 @@ beforeEach(() => { vi.mocked(prisma.documentConditionLink.createMany).mockResolvedValue({ count: 0, } as never); + vi.mocked(prisma.documentContentIndex.findUnique).mockResolvedValue( + null as never, + ); }); describe("PATCH /api/documents/inbound/[id]", () => { diff --git a/src/components/documents/document-ai-panels.tsx b/src/components/documents/document-ai-panels.tsx index bb508215b..88760bedb 100644 --- a/src/components/documents/document-ai-panels.tsx +++ b/src/components/documents/document-ai-panels.tsx @@ -316,7 +316,10 @@ export function ContentSearchStatus({ data-state="indexing" className="text-muted-foreground inline-flex items-center gap-1.5 rounded-full px-2 py-0.5 text-xs" > - + {t("documents.ai.statusIndexing")} ); diff --git a/src/components/documents/document-ai-section.tsx b/src/components/documents/document-ai-section.tsx index 56e842062..81f596717 100644 --- a/src/components/documents/document-ai-section.tsx +++ b/src/components/documents/document-ai-section.tsx @@ -142,7 +142,10 @@ export function DocumentAiSection({ disabled={indexPending || actionsDisabled} > {readLabel}