fix(test): align agent tests with connected-providers-cache fallback behavior (#1227)
Tests in utils.test.ts were written before bffa1ad introduced connected-providers-cache fallback in resolveModelWithFallback. Update assertions to match the new resolution path: - Oracle resolves to openai/gpt-5.2 via cache (not systemDefault) - Agents are created via cache fallback even without systemDefaultModel
This commit is contained in:
parent
34aaef2219
commit
9850dd0f6e
@ -47,17 +47,17 @@ describe("createBuiltinAgents with model overrides", () => {
|
|||||||
expect(agents.sisyphus.reasoningEffort).toBeUndefined()
|
expect(agents.sisyphus.reasoningEffort).toBeUndefined()
|
||||||
})
|
})
|
||||||
|
|
||||||
test("Oracle falls back to system default when availableModels is empty (even with connected cache)", async () => {
|
test("Oracle uses connected provider fallback when availableModels is empty and cache exists", async () => {
|
||||||
// #given
|
// #given - connected providers cache has "openai", which matches oracle's first fallback entry
|
||||||
const cacheSpy = spyOn(connectedProvidersCache, "readConnectedProvidersCache").mockReturnValue(["openai"])
|
const cacheSpy = spyOn(connectedProvidersCache, "readConnectedProvidersCache").mockReturnValue(["openai"])
|
||||||
|
|
||||||
// #when
|
// #when
|
||||||
const agents = await createBuiltinAgents([], {}, undefined, TEST_DEFAULT_MODEL)
|
const agents = await createBuiltinAgents([], {}, undefined, TEST_DEFAULT_MODEL)
|
||||||
|
|
||||||
// #then
|
// #then - oracle resolves via connected cache fallback to openai/gpt-5.2 (not system default)
|
||||||
expect(agents.oracle.model).toBe(TEST_DEFAULT_MODEL)
|
expect(agents.oracle.model).toBe("openai/gpt-5.2")
|
||||||
expect(agents.oracle.thinking).toEqual({ type: "enabled", budgetTokens: 32000 })
|
expect(agents.oracle.reasoningEffort).toBe("medium")
|
||||||
expect(agents.oracle.reasoningEffort).toBeUndefined()
|
expect(agents.oracle.thinking).toBeUndefined()
|
||||||
cacheSpy.mockRestore()
|
cacheSpy.mockRestore()
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -122,15 +122,16 @@ describe("createBuiltinAgents with model overrides", () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe("createBuiltinAgents without systemDefaultModel", () => {
|
describe("createBuiltinAgents without systemDefaultModel", () => {
|
||||||
test("agents NOT created when availableModels empty and no systemDefaultModel", async () => {
|
test("agents created via connected cache fallback even without systemDefaultModel", async () => {
|
||||||
// #given
|
// #given - connected cache has "openai", which matches oracle's fallback chain
|
||||||
const cacheSpy = spyOn(connectedProvidersCache, "readConnectedProvidersCache").mockReturnValue(["openai"])
|
const cacheSpy = spyOn(connectedProvidersCache, "readConnectedProvidersCache").mockReturnValue(["openai"])
|
||||||
|
|
||||||
// #when
|
// #when
|
||||||
const agents = await createBuiltinAgents([], {}, undefined, undefined)
|
const agents = await createBuiltinAgents([], {}, undefined, undefined)
|
||||||
|
|
||||||
// #then
|
// #then - connected cache enables model resolution despite no systemDefaultModel
|
||||||
expect(agents.oracle).toBeUndefined()
|
expect(agents.oracle).toBeDefined()
|
||||||
|
expect(agents.oracle.model).toBe("openai/gpt-5.2")
|
||||||
cacheSpy.mockRestore()
|
cacheSpy.mockRestore()
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -146,15 +147,16 @@ describe("createBuiltinAgents without systemDefaultModel", () => {
|
|||||||
cacheSpy.mockRestore()
|
cacheSpy.mockRestore()
|
||||||
})
|
})
|
||||||
|
|
||||||
test("sisyphus NOT created when availableModels empty and no systemDefaultModel", async () => {
|
test("sisyphus created via connected cache fallback even without systemDefaultModel", async () => {
|
||||||
// #given
|
// #given - connected cache has "anthropic", which matches sisyphus's first fallback entry
|
||||||
const cacheSpy = spyOn(connectedProvidersCache, "readConnectedProvidersCache").mockReturnValue(["anthropic"])
|
const cacheSpy = spyOn(connectedProvidersCache, "readConnectedProvidersCache").mockReturnValue(["anthropic"])
|
||||||
|
|
||||||
// #when
|
// #when
|
||||||
const agents = await createBuiltinAgents([], {}, undefined, undefined)
|
const agents = await createBuiltinAgents([], {}, undefined, undefined)
|
||||||
|
|
||||||
// #then
|
// #then - connected cache enables model resolution despite no systemDefaultModel
|
||||||
expect(agents.sisyphus).toBeUndefined()
|
expect(agents.sisyphus).toBeDefined()
|
||||||
|
expect(agents.sisyphus.model).toBe("anthropic/claude-opus-4-5")
|
||||||
cacheSpy.mockRestore()
|
cacheSpy.mockRestore()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user