Skip to content

Commit 8b76585

Browse files
committed
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
1 parent 7a6e852 commit 8b76585

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

src/api/providers/__tests__/openrouter.spec.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,24 @@ describe("OpenRouterHandler", () => {
6868
})
6969
})
7070

71+
it("uses custom base URL when provided", () => {
72+
const customBaseUrl = "https://custom.openrouter.ai/v1"
73+
const handler = new OpenRouterHandler({
74+
...mockOptions,
75+
openRouterBaseUrl: customBaseUrl,
76+
})
77+
78+
expect(OpenAI).toHaveBeenCalledWith({
79+
baseURL: customBaseUrl,
80+
apiKey: mockOptions.openRouterApiKey,
81+
defaultHeaders: {
82+
"HTTP-Referer": "https://github.com/RooVetGit/Roo-Cline",
83+
"X-Title": "Roo Code",
84+
"User-Agent": `RooCode/${Package.version}`,
85+
},
86+
})
87+
})
88+
7189
describe("fetchModel", () => {
7290
it("returns correct model info when options are provided", async () => {
7391
const handler = new OpenRouterHandler(mockOptions)

0 commit comments

Comments
 (0)