Skip to content

Commit 2a1ece0

Browse files
committed
test: update getApiProtocol tests to match new function signature
1 parent e016857 commit 2a1ece0

File tree

1 file changed

+10
-52
lines changed

1 file changed

+10
-52
lines changed

packages/types/src/__tests__/provider-settings.test.ts

Lines changed: 10 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -5,75 +5,33 @@ describe("getApiProtocol", () => {
55
describe("Anthropic-style providers", () => {
66
it("should return 'anthropic' for anthropic provider", () => {
77
expect(getApiProtocol("anthropic")).toBe("anthropic")
8-
expect(getApiProtocol("anthropic", "gpt-4")).toBe("anthropic")
98
})
109

1110
it("should return 'anthropic' for claude-code provider", () => {
1211
expect(getApiProtocol("claude-code")).toBe("anthropic")
13-
expect(getApiProtocol("claude-code", "some-model")).toBe("anthropic")
1412
})
1513
})
1614

17-
describe("Vertex provider with Claude models", () => {
18-
it("should return 'anthropic' for vertex provider with claude models", () => {
19-
expect(getApiProtocol("vertex", "claude-3-opus")).toBe("anthropic")
20-
expect(getApiProtocol("vertex", "Claude-3-Sonnet")).toBe("anthropic")
21-
expect(getApiProtocol("vertex", "CLAUDE-instant")).toBe("anthropic")
22-
expect(getApiProtocol("vertex", "anthropic/claude-3-haiku")).toBe("anthropic")
23-
})
24-
25-
it("should return 'openai' for vertex provider with non-claude models", () => {
26-
expect(getApiProtocol("vertex", "gpt-4")).toBe("openai")
27-
expect(getApiProtocol("vertex", "gemini-pro")).toBe("openai")
28-
expect(getApiProtocol("vertex", "llama-2")).toBe("openai")
29-
})
30-
})
31-
32-
describe("Bedrock provider with Claude models", () => {
33-
it("should return 'anthropic' for bedrock provider with claude models", () => {
34-
expect(getApiProtocol("bedrock", "claude-3-opus")).toBe("anthropic")
35-
expect(getApiProtocol("bedrock", "Claude-3-Sonnet")).toBe("anthropic")
36-
expect(getApiProtocol("bedrock", "CLAUDE-instant")).toBe("anthropic")
37-
expect(getApiProtocol("bedrock", "anthropic.claude-v2")).toBe("anthropic")
15+
describe("Non-Anthropic providers", () => {
16+
it("should return 'openai' for vertex provider", () => {
17+
expect(getApiProtocol("vertex")).toBe("openai")
3818
})
3919

40-
it("should return 'openai' for bedrock provider with non-claude models", () => {
41-
expect(getApiProtocol("bedrock", "gpt-4")).toBe("openai")
42-
expect(getApiProtocol("bedrock", "titan-text")).toBe("openai")
43-
expect(getApiProtocol("bedrock", "llama-2")).toBe("openai")
20+
it("should return 'openai' for bedrock provider", () => {
21+
expect(getApiProtocol("bedrock")).toBe("openai")
4422
})
45-
})
4623

47-
describe("Other providers with Claude models", () => {
48-
it("should return 'openai' for non-vertex/bedrock providers with claude models", () => {
49-
expect(getApiProtocol("openrouter", "claude-3-opus")).toBe("openai")
50-
expect(getApiProtocol("openai", "claude-3-sonnet")).toBe("openai")
51-
expect(getApiProtocol("litellm", "claude-instant")).toBe("openai")
52-
expect(getApiProtocol("ollama", "claude-model")).toBe("openai")
24+
it("should return 'openai' for other providers", () => {
25+
expect(getApiProtocol("openrouter")).toBe("openai")
26+
expect(getApiProtocol("openai")).toBe("openai")
27+
expect(getApiProtocol("litellm")).toBe("openai")
28+
expect(getApiProtocol("ollama")).toBe("openai")
5329
})
5430
})
5531

5632
describe("Edge cases", () => {
5733
it("should return 'openai' when provider is undefined", () => {
5834
expect(getApiProtocol(undefined)).toBe("openai")
59-
expect(getApiProtocol(undefined, "claude-3-opus")).toBe("openai")
60-
})
61-
62-
it("should return 'openai' when model is undefined", () => {
63-
expect(getApiProtocol("openai")).toBe("openai")
64-
expect(getApiProtocol("vertex")).toBe("openai")
65-
expect(getApiProtocol("bedrock")).toBe("openai")
66-
})
67-
68-
it("should handle empty strings", () => {
69-
expect(getApiProtocol("vertex", "")).toBe("openai")
70-
expect(getApiProtocol("bedrock", "")).toBe("openai")
71-
})
72-
73-
it("should be case-insensitive for claude detection", () => {
74-
expect(getApiProtocol("vertex", "CLAUDE-3-OPUS")).toBe("anthropic")
75-
expect(getApiProtocol("bedrock", "claude-3-opus")).toBe("anthropic")
76-
expect(getApiProtocol("vertex", "ClAuDe-InStAnT")).toBe("anthropic")
7735
})
7836
})
7937
})

0 commit comments

Comments
 (0)