From c229829663230e68d154ccc926d3aeeeb36f0cd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc-Andr=C3=A9=20Bombeck?= Date: Thu, 24 Sep 2026 10:52:04 +0200 Subject: [PATCH] test(health-score): answer the provider probe in the configured-flag checks The provider mock lacked `probeProviderChain`, so the capability loader threw on every wire and read `check_failed`. It now answers "no provider" like the rest of the mock, and the derived payload pins `no_provider` so a starved loader fails the file. --- .../health-score-configured-flag.test.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/integration/health-score-configured-flag.test.ts b/tests/integration/health-score-configured-flag.test.ts index b36609a20..91a556b29 100644 --- a/tests/integration/health-score-configured-flag.test.ts +++ b/tests/integration/health-score-configured-flag.test.ts @@ -69,6 +69,14 @@ vi.mock("@/lib/db-compat", () => ({ vi.mock("@/lib/ai/provider", () => ({ resolveProvider: vi.fn().mockResolvedValue({ type: "none" }), hasAnyConfiguredProvider: vi.fn().mockResolvedValue(false), + // The AI capability loader's presence probe, answering the same "no + // provider". Without it the loader throws and every capability on the + // three wires reads `check_failed` instead of `no_provider`. + probeProviderChain: vi.fn().mockResolvedValue({ + entries: [], + localOcrEnabled: false, + managedBy: null, + }), })); const DAY = 24 * 60 * 60 * 1000; @@ -236,9 +244,14 @@ async function readWires(): Promise { data: { status: string; value: { configured?: boolean } | null; + ai: { reason: string | null }; } | null; }; expect(derivedBody.data?.status).toBe("ok"); + // The AI state rides the same payload. `no_provider` is this fixture's + // honest answer; `check_failed` would mean a mock starved the capability + // loader and every wire above was read on its failure path. + expect(derivedBody.data?.ai.reason).toBe("no_provider"); return { snapshot: snapshotBody.data!.healthScore!.configured,