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.
This commit is contained in:
Marc-André Bombeck committed 2026-09-24 10:52:04 +02:00
1 parent 00f6eb6dcb
commit c229829663
1 file changed
+13
@@ -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<Wires> {
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,