fix(test): update tests to reflect new model-resolver behavior
This commit is contained in:
parent
0e7ee2ac30
commit
7c15b06da7
@ -47,18 +47,17 @@ describe("createBuiltinAgents with model overrides", () => {
|
|||||||
expect(agents.sisyphus.reasoningEffort).toBeUndefined()
|
expect(agents.sisyphus.reasoningEffort).toBeUndefined()
|
||||||
})
|
})
|
||||||
|
|
||||||
test("Oracle uses connected provider when no availableModels but connected cache exists", async () => {
|
test("Oracle falls back to system default when availableModels is empty (even with connected cache)", async () => {
|
||||||
// #given - connected providers cache exists with openai
|
// #given
|
||||||
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 - uses openai from connected cache
|
// #then
|
||||||
expect(agents.oracle.model).toBe("openai/gpt-5.2")
|
expect(agents.oracle.model).toBe(TEST_DEFAULT_MODEL)
|
||||||
expect(agents.oracle.reasoningEffort).toBe("medium")
|
expect(agents.oracle.thinking).toEqual({ type: "enabled", budgetTokens: 32000 })
|
||||||
expect(agents.oracle.textVerbosity).toBe("high")
|
expect(agents.oracle.reasoningEffort).toBeUndefined()
|
||||||
expect(agents.oracle.thinking).toBeUndefined()
|
|
||||||
cacheSpy.mockRestore()
|
cacheSpy.mockRestore()
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -123,41 +122,39 @@ describe("createBuiltinAgents with model overrides", () => {
|
|||||||
})
|
})
|
||||||
|
|
||||||
describe("createBuiltinAgents without systemDefaultModel", () => {
|
describe("createBuiltinAgents without systemDefaultModel", () => {
|
||||||
test("creates agents with connected provider when cache exists", async () => {
|
test("agents NOT created when availableModels empty and no systemDefaultModel", async () => {
|
||||||
// #given - connected providers cache exists
|
// #given
|
||||||
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 - agents should use connected provider from fallback chain
|
// #then
|
||||||
expect(agents.oracle).toBeDefined()
|
expect(agents.oracle).toBeUndefined()
|
||||||
expect(agents.oracle.model).toBe("openai/gpt-5.2")
|
|
||||||
cacheSpy.mockRestore()
|
cacheSpy.mockRestore()
|
||||||
})
|
})
|
||||||
|
|
||||||
test("agents NOT created when no cache and no systemDefaultModel (first run without defaults)", async () => {
|
test("agents NOT created when no cache and no systemDefaultModel (first run without defaults)", async () => {
|
||||||
// #given - no cache and no system default
|
// #given
|
||||||
const cacheSpy = spyOn(connectedProvidersCache, "readConnectedProvidersCache").mockReturnValue(null)
|
const cacheSpy = spyOn(connectedProvidersCache, "readConnectedProvidersCache").mockReturnValue(null)
|
||||||
|
|
||||||
// #when
|
// #when
|
||||||
const agents = await createBuiltinAgents([], {}, undefined, undefined)
|
const agents = await createBuiltinAgents([], {}, undefined, undefined)
|
||||||
|
|
||||||
// #then - oracle should NOT be created (resolveModelWithFallback returns undefined)
|
// #then
|
||||||
expect(agents.oracle).toBeUndefined()
|
expect(agents.oracle).toBeUndefined()
|
||||||
cacheSpy.mockRestore()
|
cacheSpy.mockRestore()
|
||||||
})
|
})
|
||||||
|
|
||||||
test("sisyphus uses connected provider when cache exists", async () => {
|
test("sisyphus NOT created when availableModels empty and no systemDefaultModel", async () => {
|
||||||
// #given - connected providers cache exists with anthropic
|
// #given
|
||||||
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 - sisyphus should use anthropic from connected cache
|
// #then
|
||||||
expect(agents.sisyphus).toBeDefined()
|
expect(agents.sisyphus).toBeUndefined()
|
||||||
expect(agents.sisyphus.model).toBe("anthropic/claude-opus-4-5")
|
|
||||||
cacheSpy.mockRestore()
|
cacheSpy.mockRestore()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user