Skip to content

Commit ad8ad76

Browse files
committed
PR feedback
1 parent 7a93a58 commit ad8ad76

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

src/api/providers/__tests__/gemini.test.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33
import { Anthropic } from "@anthropic-ai/sdk"
44

55
import { GeminiHandler } from "../gemini"
6+
import { geminiDefaultModelId } from "../../../shared/api"
7+
8+
const GEMINI_20_FLASH_THINKING_NAME = "gemini-2.0-flash-thinking-exp-1219"
69

710
describe("GeminiHandler", () => {
811
let handler: GeminiHandler
@@ -15,7 +18,7 @@ describe("GeminiHandler", () => {
1518

1619
handler = new GeminiHandler({
1720
apiKey: "test-key",
18-
apiModelId: "gemini-2.0-flash-thinking-exp-1219",
21+
apiModelId: GEMINI_20_FLASH_THINKING_NAME,
1922
geminiApiKey: "test-key",
2023
})
2124

@@ -32,7 +35,7 @@ describe("GeminiHandler", () => {
3235
describe("constructor", () => {
3336
it("should initialize with provided config", () => {
3437
expect(handler["options"].geminiApiKey).toBe("test-key")
35-
expect(handler["options"].apiModelId).toBe("gemini-2.0-flash-thinking-exp-1219")
38+
expect(handler["options"].apiModelId).toBe(GEMINI_20_FLASH_THINKING_NAME)
3639
})
3740
})
3841

@@ -86,7 +89,7 @@ describe("GeminiHandler", () => {
8689
// Verify the call to generateContentStream
8790
expect(handler.client.models.generateContentStream).toHaveBeenCalledWith(
8891
expect.objectContaining({
89-
model: "gemini-2.0-flash-thinking-exp-1219",
92+
model: GEMINI_20_FLASH_THINKING_NAME,
9093
config: expect.objectContaining({
9194
temperature: 0,
9295
systemInstruction: systemPrompt,
@@ -121,7 +124,7 @@ describe("GeminiHandler", () => {
121124

122125
// Verify the call to generateContent
123126
expect(handler.client.models.generateContent).toHaveBeenCalledWith({
124-
model: "gemini-2.0-flash-thinking-exp-1219",
127+
model: GEMINI_20_FLASH_THINKING_NAME,
125128
contents: [{ role: "user", parts: [{ text: "Test prompt" }] }],
126129
config: {
127130
httpOptions: undefined,
@@ -153,7 +156,7 @@ describe("GeminiHandler", () => {
153156
describe("getModel", () => {
154157
it("should return correct model info", () => {
155158
const modelInfo = handler.getModel()
156-
expect(modelInfo.id).toBe("gemini-2.0-flash-thinking-exp-1219")
159+
expect(modelInfo.id).toBe(GEMINI_20_FLASH_THINKING_NAME)
157160
expect(modelInfo.info).toBeDefined()
158161
expect(modelInfo.info.maxTokens).toBe(8192)
159162
expect(modelInfo.info.contextWindow).toBe(32_767)
@@ -165,7 +168,7 @@ describe("GeminiHandler", () => {
165168
geminiApiKey: "test-key",
166169
})
167170
const modelInfo = invalidHandler.getModel()
168-
expect(modelInfo.id).toBe("gemini-2.0-flash-001") // Default model
171+
expect(modelInfo.id).toBe(geminiDefaultModelId) // Default model
169172
})
170173
})
171174
})

0 commit comments

Comments
 (0)