Skip to content

Commit 8f54506

Browse files
committed
Add tests for litellm URL constructor fix
1 parent 6718d87 commit 8f54506

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

src/api/providers/fetchers/__tests__/litellm.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,26 @@ describe("getLiteLLMModels", () => {
1212
jest.clearAllMocks()
1313
})
1414

15+
it("handles base URLs with trailing slashes correctly", async () => {
16+
const mockResponse = {
17+
data: {
18+
data: [],
19+
},
20+
}
21+
22+
mockedAxios.get.mockResolvedValue(mockResponse)
23+
24+
await getLiteLLMModels("test-api-key", "http://localhost:4000/")
25+
26+
expect(mockedAxios.get).toHaveBeenCalledWith("http://localhost:4000/v1/model/info", {
27+
headers: {
28+
Authorization: "Bearer test-api-key",
29+
"Content-Type": "application/json",
30+
},
31+
timeout: 5000,
32+
})
33+
})
34+
1535
it("successfully fetches and formats LiteLLM models", async () => {
1636
const mockResponse = {
1737
data: {

0 commit comments

Comments
 (0)