test(documents): type the index fixtures instead of casting them away

The resource-limit cases and two older mocks now pass typed values, so the
file carries fewer as-never casts than before; the outcome list's comment
is a line shorter to keep its file at its length. Both ratchet baselines
are written down, the source size one also for offhost-backup.ts, which
had shrunk without its number following.
This commit is contained in:
Marc-André Bombeck committed 2026-10-25 16:24:15 +01:00
1 parent 430468932c
commit 6b9b9a3f8d
4 files changed
+13 -12

No files matched your search

@@ -1,7 +1,7 @@
{
"$comment": "Production files over 800 lines and their length. Maintained by src/__tests__/source-size-ratchet.test.ts.",
"count": 84,
"total": 94948,
"total": 94928,
"entries": {
"app/medications/page-client.tsx": 839,
"components/charts/mood-chart.tsx": 1166,
@@ -66,7 +66,7 @@
"lib/jobs/coach-nudge.ts": 1084,
"lib/jobs/insight-pregenerate.ts": 1189,
"lib/jobs/medication-intake-import.ts": 819,
"lib/jobs/offhost-backup.ts": 1114,
"lib/jobs/offhost-backup.ts": 1094,
"lib/jobs/reaction-line.ts": 803,
"lib/managed-profiles/handover.ts": 986,
"lib/mcp/record-search.ts": 1467,
+2 -2
View File
@@ -1,7 +1,7 @@
{
"$comment": "as never casts in tests, per test file under src/. Maintained by src/__tests__/test-realism-ratchet.test.ts.",
"count": 524,
"total": 5489,
"total": 5488,
"entries": {
"__tests__/api/auth/login/mfa-branch.test.ts": 10,
"__tests__/api/auth/mfa/verify.test.ts": 9,
@@ -361,7 +361,7 @@
"lib/documents/__tests__/assist-kinds.test.ts": 1,
"lib/documents/__tests__/commit.test.ts": 9,
"lib/documents/__tests__/fenced-chat-pipeline.test.ts": 6,
"lib/documents/__tests__/index-document.test.ts": 23,
"lib/documents/__tests__/index-document.test.ts": 22,
"lib/documents/__tests__/index-outcome-record.test.ts": 14,
"lib/documents/__tests__/prepare-vision-raster-failure.test.ts": 6,
"lib/documents/__tests__/provider-order.test.ts": 1,
@@ -115,7 +115,7 @@ beforeEach(() => {
ok: true,
text: "glucose fasting creatinine values report",
source: "local-pdf",
} as never);
});
// Default: the auto-read toggle is ON (so the external-pick provider path is
// exercised); the OFF-specific tests override this explicitly.
vi.mocked(documentAutoReadEnabled).mockResolvedValue(true);
@@ -284,7 +284,7 @@ describe("indexDocumentContent — local fallback path", () => {
vi.mocked(localExtractText).mockResolvedValue({
ok: false,
reason: "empty",
} as never);
});
const outcome = await indexDocumentContent("user-1", "doc-1");
expect(outcome).toEqual({ indexed: false, reason: "local-empty" });
@@ -295,7 +295,9 @@ describe("indexDocumentContent — local fallback path", () => {
vi.mocked(resolveDocumentVisionProvider).mockResolvedValue({
chain: [],
pick: null,
} as never);
localOcrEnabled: false,
withheld: null,
});
vi.mocked(localExtractText).mockResolvedValue({
ok: false,
reason: "resource-limit",
@@ -308,10 +310,10 @@ describe("indexDocumentContent — local fallback path", () => {
it("keeps resource-limit over a provider note: the provider never got further either", async () => {
vi.mocked(resolveDocumentVisionProvider).mockResolvedValue(PICK as never);
vi.mocked(prepareVisionInput).mockReturnValue({
vi.mocked(prepareVisionInput).mockResolvedValue({
ok: false,
reason: "rasterFailed",
} as never);
});
vi.mocked(localExtractText).mockResolvedValue({
ok: false,
reason: "resource-limit",
+2 -3
View File
@@ -107,9 +107,8 @@ export type DocumentSummaryStateValue =
/**
* Refs #776 — why a document's most recent content-index attempt produced no
* index. Mirrors the free-String `lastIndexOutcome` column (closed here, not
* in the schema, so a new reason needs no migration); the detail view renders
* a plain-words line per value instead of a bare "not indexed" that cannot
* tell "never tried" from "tried and failed".
* in the schema, so a new reason needs no migration); the detail view says
* each in plain words, so "never tried" and "tried and failed" differ.
*/
export const DOCUMENT_INDEX_OUTCOMES = [
"local-empty",