test: align OpenRouter default fallback (4.5) and reinit gating expectations in ClineProvider specs

This commit is contained in:
Hannes Rudolph 2025-11-05 15:12:57 -07:00
parent b57bf9f327
commit 13d6843679
2 changed files with 6 additions and 4 deletions

View file

@ -124,7 +124,7 @@ describe("OpenRouterHandler", () => {
const handler = new OpenRouterHandler({})
const logSpy = vitest.spyOn(console, "log").mockImplementation(() => {})
const model = handler.getModel()
expect(model.id).toBe("anthropic/claude-sonnet-4")
expect(model.id).toBe("anthropic/claude-sonnet-4.5")
expect(model.info.supportsPromptCache).toBe(true)
expect(logSpy).toHaveBeenCalledWith("[model-cache] source:", "default-fallback")
logSpy.mockRestore()

View file

@ -2106,11 +2106,13 @@ describe("ClineProvider", () => {
apiConfiguration: testApiConfig,
})
// Verify error handling
expect(mockOutputChannel.appendLine).toHaveBeenCalledWith(
// With reinit now gated on provider/model/baseUrl changes, no reinit occurs here.
// Therefore buildApiHandler is not called and no error is logged or shown.
expect(buildApiHandler as any).not.toHaveBeenCalled()
expect(mockOutputChannel.appendLine).not.toHaveBeenCalledWith(
expect.stringContaining("Error create new api configuration"),
)
expect(vscode.window.showErrorMessage).toHaveBeenCalledWith("errors.create_api_config")
expect(vscode.window.showErrorMessage).not.toHaveBeenCalledWith("errors.create_api_config")
// Verify state was still updated
expect(mockContext.globalState.update).toHaveBeenCalledWith("listApiConfigMeta", [