Skip to content

Commit 853f8f2

Browse files
committed
test(types): cover cross-category provider guards
1 parent 8369dec commit 853f8f2

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

‎packages/types/src/__tests__/provider-identifiers.test.ts‎

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,27 @@ describe("provider identifiers", () => {
137137
expect(isInternalProvider("unknown-provider")).toBe(false)
138138
expect(isCustomProvider("unknown-provider")).toBe(false)
139139
expect(isFauxProvider("unknown-provider")).toBe(false)
140+
141+
const categoryRepresentatives = [
142+
providerIdentifiers.openrouter,
143+
providerIdentifiers.ollama,
144+
providerIdentifiers.vscodeLm,
145+
providerIdentifiers.openai,
146+
providerIdentifiers.fakeAi,
147+
]
148+
const categoryGuards = [
149+
isDynamicProvider,
150+
isLocalProvider,
151+
isInternalProvider,
152+
isCustomProvider,
153+
isFauxProvider,
154+
]
155+
156+
for (const [guardIndex, guard] of categoryGuards.entries()) {
157+
for (const [identifierIndex, identifier] of categoryRepresentatives.entries()) {
158+
expect(guard(identifier)).toBe(guardIndex === identifierIndex)
159+
}
160+
}
140161
})
141162

142163
it("keeps active and retired providers separate", () => {

0 commit comments

Comments
 (0)