refactor(kilocode-tests): share eligibility assertions

This commit is contained in:
Peter Steinberger 2026-03-17 07:38:49 +00:00
parent 0956de7316
commit be6716c7aa

View File

@ -2,12 +2,10 @@ import { describe, expect, it } from "vitest";
import { isCacheTtlEligibleProvider } from "./cache-ttl.js";
describe("kilocode cache-ttl eligibility", () => {
it("is eligible when model starts with anthropic/", () => {
expect(isCacheTtlEligibleProvider("kilocode", "anthropic/claude-opus-4.6")).toBe(true);
});
it("is eligible with other anthropic models", () => {
expect(isCacheTtlEligibleProvider("kilocode", "anthropic/claude-sonnet-4")).toBe(true);
it("allows anthropic models", () => {
for (const modelId of ["anthropic/claude-opus-4.6", "anthropic/claude-sonnet-4"] as const) {
expect(isCacheTtlEligibleProvider("kilocode", modelId)).toBe(true);
}
});
it("is not eligible for non-anthropic models on kilocode", () => {
@ -15,7 +13,11 @@ describe("kilocode cache-ttl eligibility", () => {
});
it("is case-insensitive for provider name", () => {
expect(isCacheTtlEligibleProvider("Kilocode", "anthropic/claude-opus-4.6")).toBe(true);
expect(isCacheTtlEligibleProvider("KILOCODE", "Anthropic/claude-opus-4.6")).toBe(true);
for (const [provider, modelId] of [
["Kilocode", "anthropic/claude-opus-4.6"],
["KILOCODE", "Anthropic/claude-opus-4.6"],
] as const) {
expect(isCacheTtlEligibleProvider(provider, modelId)).toBe(true);
}
});
});