test: add test to verify OpenRouter custom base URL is used correctly

- Added test case to ensure custom base URLs are properly passed to the OpenAI client
- This helps prevent regression of issue #6269 where custom base URLs were being ignored

Fixes #6269
This commit is contained in:
Roo Code 2025-07-27 06:10:07 +00:00
parent 7a6e852248
commit 8b76585566

View file

@ -68,6 +68,24 @@ describe("OpenRouterHandler", () => {
})
})
it("uses custom base URL when provided", () => {
const customBaseUrl = "https://custom.openrouter.ai/v1"
const handler = new OpenRouterHandler({
...mockOptions,
openRouterBaseUrl: customBaseUrl,
})
expect(OpenAI).toHaveBeenCalledWith({
baseURL: customBaseUrl,
apiKey: mockOptions.openRouterApiKey,
defaultHeaders: {
"HTTP-Referer": "https://github.com/RooVetGit/Roo-Cline",
"X-Title": "Roo Code",
"User-Agent": `RooCode/${Package.version}`,
},
})
})
describe("fetchModel", () => {
it("returns correct model info when options are provided", async () => {
const handler = new OpenRouterHandler(mockOptions)