mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-10 21:32:18 +00:00
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.
This commit is contained in:
1 parent
11fd48cc0e
commit
0b973f4f76
3 files changed
+14
-2
No files matched your search
@@ -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]", () => {
|
||||
|
||||
@@ -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"
|
||||
>
|
||||
<Loader2 className="size-3.5 shrink-0 animate-spin" aria-hidden />
|
||||
<Loader2
|
||||
className="size-3.5 shrink-0 animate-spin motion-reduce:animate-none"
|
||||
aria-hidden
|
||||
/>
|
||||
{t("documents.ai.statusIndexing")}
|
||||
</span>
|
||||
);
|
||||
|
||||
@@ -142,7 +142,10 @@ export function DocumentAiSection({
|
||||
disabled={indexPending || actionsDisabled}
|
||||
>
|
||||
<ScanText
|
||||
className={cn("size-4", indexPending && "animate-pulse")}
|
||||
className={cn(
|
||||
"size-4",
|
||||
indexPending && "animate-pulse motion-reduce:animate-none",
|
||||
)}
|
||||
aria-hidden
|
||||
/>
|
||||
{readLabel}
|
||||
|
||||
Reference in new issue
Block a user