test: specify Kilo static catalog

This commit is contained in:
Shakker
2026-05-11 23:31:51 +01:00
parent 4bfd7416f0
commit ddf83d16f7
2 changed files with 26 additions and 7 deletions

View File

@@ -7,6 +7,16 @@ describe("Kilo Gateway implicit provider", () => {
expect(provider.baseUrl).toBe("https://api.kilo.ai/api/gateway/");
expect(provider.api).toBe("openai-completions");
expect(provider.models.length).toBeGreaterThan(0);
expect(provider.models).toStrictEqual([
{
id: "kilo/auto",
name: "Kilo Auto",
reasoning: true,
input: ["text", "image"],
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
contextWindow: 1000000,
maxTokens: 128000,
},
]);
});
});

View File

@@ -26,6 +26,18 @@ type MockKilocodeFetch = ((
mock: { calls: unknown[][] };
};
const EXPECTED_STATIC_KILOCODE_MODELS = [
{
id: "kilo/auto",
name: "Kilo Auto",
reasoning: true,
input: ["text", "image"],
cost: { input: 0, output: 0, cacheRead: 0, cacheWrite: 0 },
contextWindow: 1000000,
maxTokens: 128000,
},
];
function requireModelById(
models: Awaited<ReturnType<typeof discoverKilocodeModels>>,
id: string,
@@ -127,8 +139,7 @@ afterAll(() => {
describe("discoverKilocodeModels", () => {
it("returns static catalog in test environment", async () => {
const models = await discoverKilocodeModels();
expect(models.length).toBeGreaterThan(0);
expect(requireModelById(models, "kilo/auto").id).toBe("kilo/auto");
expect(models).toStrictEqual(EXPECTED_STATIC_KILOCODE_MODELS);
});
it("static catalog has correct defaults for kilo/auto", async () => {
@@ -190,8 +201,7 @@ describe("discoverKilocodeModels (fetch path)", () => {
const mockFetch = vi.fn().mockRejectedValue(new Error("network error"));
await withFetchPathTest(mockFetch, async () => {
const models = await discoverKilocodeModels();
expect(models.length).toBeGreaterThan(0);
expect(requireModelById(models, "kilo/auto").id).toBe("kilo/auto");
expect(models).toStrictEqual(EXPECTED_STATIC_KILOCODE_MODELS);
});
});
@@ -202,8 +212,7 @@ describe("discoverKilocodeModels (fetch path)", () => {
});
await withFetchPathTest(mockFetch, async () => {
const models = await discoverKilocodeModels();
expect(models.length).toBeGreaterThan(0);
expect(requireModelById(models, "kilo/auto").id).toBe("kilo/auto");
expect(models).toStrictEqual(EXPECTED_STATIC_KILOCODE_MODELS);
});
});