Skip to content

Commit 1bfbd7e

Browse files
committed
refactor: simplify OpenRouter caching test logic
- Replace hardcoded exclusion list with simple Google model filter - Keep original validation logic but make it more maintainable - Still ensures all our caching models are supported by OpenRouter - Still verifies we exclude all Google models from explicit caching
1 parent bfc1071 commit 1bfbd7e

File tree

1 file changed

+3
-18
lines changed

1 file changed

+3
-18
lines changed

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

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,6 @@ describe("OpenRouter API", () => {
2323

2424
const models = await getOpenRouterModels()
2525

26-
// Check that our caching models list is a subset of what OpenRouter supports
27-
// (we may intentionally exclude some models that support caching)
2826
const openRouterSupportedCaching = Object.entries(models)
2927
.filter(([_, model]) => model.supportsPromptCache)
3028
.map(([id, _]) => id)
@@ -36,22 +34,9 @@ describe("OpenRouter API", () => {
3634
expect(openRouterSupportedCaching).toContain(modelId)
3735
}
3836

39-
// Check that we have the expected models (excluding intentionally excluded ones)
40-
const excludedCachingModels = new Set([
41-
// All Google models intentionally excluded from caching
42-
"google/gemini-2.5-pro-preview",
43-
"google/gemini-2.0-flash-001",
44-
"google/gemini-2.5-flash-preview",
45-
"google/gemini-2.5-flash-preview-05-20",
46-
"google/gemini-2.5-flash-preview-05-20:thinking",
47-
"google/gemini-2.5-flash-preview:thinking",
48-
"google/gemini-flash-1.5",
49-
"google/gemini-flash-1.5-8b",
50-
])
51-
52-
const expectedCachingModels = openRouterSupportedCaching
53-
.filter((id) => !excludedCachingModels.has(id))
54-
.sort()
37+
// Verify we have all supported models except intentionally excluded Google models
38+
const excludedModels = openRouterSupportedCaching.filter((id) => id.startsWith("google/"))
39+
const expectedCachingModels = openRouterSupportedCaching.filter((id) => !id.startsWith("google/")).sort()
5540

5641
expect(ourCachingModels.sort()).toEqual(expectedCachingModels)
5742

0 commit comments

Comments
 (0)