Make fallback provider selection provider-agnostic

This commit is contained in:
Ravi Tharuma
2026-03-04 18:55:43 +01:00
committed by YeonGyu-Kim
parent eab5be666d
commit f2d23a8a36
2 changed files with 13 additions and 12 deletions
+4 -4
View File
@@ -88,17 +88,17 @@ describe("model-error-classifier", () => {
expect(provider).toBe("anthropic")
})
test("selectFallbackProvider maps opencode fallback to quotio when quotio is connected", () => {
test("selectFallbackProvider uses connected preferred provider when fallback providers are unavailable", () => {
//#given
writeFileSync(
join(TEST_CACHE_DIR, "connected-providers.json"),
JSON.stringify({ connected: ["quotio"], updatedAt: new Date().toISOString() }, null, 2),
JSON.stringify({ connected: ["provider-x"], updatedAt: new Date().toISOString() }, null, 2),
)
//#when
const provider = selectFallbackProvider(["opencode"], "quotio")
const provider = selectFallbackProvider(["provider-y"], "provider-x")
//#then
expect(provider).toBe("quotio")
expect(provider).toBe("provider-x")
})
})