Skip to content

Commit 292c89f

Browse files
committed
# <type>(<scope>): Max. 50 characters ------->
# type: feat fix doc perf refactor style test infra ci chore # # Problem: # merge main to gemini-cli # Solution: # # Test Plan: # # Body: Max. 72 characters per line ---->
1 parent 6028948 commit 292c89f

File tree

12 files changed

+66
-40
lines changed

12 files changed

+66
-40
lines changed

src/test-scripts/g_cli_provider/phase2_oauth/browser_integration.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -204,8 +204,8 @@ describe("Phase 2: Browser Integration", () => {
204204
describe("Browser Detection", () => {
205205
it("should detect available browsers on system", async () => {
206206
if (oauthManager) {
207-
const mockExec = vi.mocked(exec).mockImplementation((command, callback) => {
208-
if (command.includes("which")) {
207+
const mockExec = vi.mocked(exec).mockImplementation((command: string, callback?: any) => {
208+
if (typeof callback === "function" && command.includes("which")) {
209209
callback(null, "/usr/bin/google-chrome", "")
210210
}
211211
return {} as any

src/test-scripts/g_cli_provider/phase2_oauth/credential_operations.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ describe("Phase 2: OAuth Credential Operations", () => {
6969

7070
it("should return null if credentials file doesn't exist", async () => {
7171
if (oauthManager) {
72-
const enoentError = new Error("ENOENT: no such file or directory")
72+
const enoentError = new Error("ENOENT: no such file or directory") as NodeJS.ErrnoException
7373
enoentError.code = "ENOENT"
7474
vi.mocked(fs.readFile).mockRejectedValue(enoentError)
7575

@@ -97,7 +97,7 @@ describe("Phase 2: OAuth Credential Operations", () => {
9797

9898
it("should handle file permission errors", async () => {
9999
if (oauthManager) {
100-
const permissionError = new Error("EACCES: permission denied")
100+
const permissionError = new Error("EACCES: permission denied") as NodeJS.ErrnoException
101101
permissionError.code = "EACCES"
102102
vi.mocked(fs.readFile).mockRejectedValue(permissionError)
103103

src/test-scripts/g_cli_provider/phase3_api_client/error_handling.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ describe("Phase 3: Error Handling", () => {
244244

245245
it("should handle DNS resolution errors", async () => {
246246
if (apiClient) {
247-
const dnsError = new Error("getaddrinfo ENOTFOUND")
247+
const dnsError = new Error("getaddrinfo ENOTFOUND") as NodeJS.ErrnoException
248248
dnsError.code = "ENOTFOUND"
249249
vi.mocked(fetch).mockRejectedValue(dnsError)
250250

@@ -263,7 +263,7 @@ describe("Phase 3: Error Handling", () => {
263263

264264
it("should handle SSL certificate errors", async () => {
265265
if (apiClient) {
266-
const sslError = new Error("certificate verify failed")
266+
const sslError = new Error("certificate verify failed") as NodeJS.ErrnoException
267267
sslError.code = "CERT_UNTRUSTED"
268268
vi.mocked(fetch).mockRejectedValue(sslError)
269269

src/test-scripts/g_cli_provider/phase3_api_client/performance.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ describe("Phase 3: Performance", () => {
112112

113113
// Create large message history (100 messages)
114114
const messages = Array.from({ length: 100 }, (_, i) => ({
115-
role: (i % 2 === 0 ? "user" : "assistant") as const,
115+
role: i % 2 === 0 ? ("user" as const) : ("assistant" as const),
116116
content: [{ type: "text" as const, text: `Message ${i}` }],
117117
}))
118118

src/test-scripts/g_cli_provider/phase3_api_client/sse_parsing.test.ts

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,31 @@ global.ReadableStream = class MockReadableStream {
1313
this.source = source
1414
}
1515
source: any
16+
locked: boolean = false
1617

1718
getReader() {
1819
return {
1920
read: vi.fn(),
2021
releaseLock: vi.fn(),
2122
}
2223
}
23-
}
24+
25+
cancel(): Promise<void> {
26+
return Promise.resolve()
27+
}
28+
29+
pipeThrough<T>(transform: any): ReadableStream<T> {
30+
return this as any
31+
}
32+
33+
pipeTo(destination: any): Promise<void> {
34+
return Promise.resolve()
35+
}
36+
37+
tee(): [ReadableStream<any>, ReadableStream<any>] {
38+
return [this as any, this as any]
39+
}
40+
} as any
2441

2542
describe("Phase 3: SSE Parsing", () => {
2643
let apiClient: any
@@ -134,7 +151,7 @@ data: {"candidates":[{"content":{"parts":[{"text":" world"}]}}]}
134151
it("should handle malformed SSE data gracefully", async () => {
135152
if (apiClient) {
136153
const malformedData = `data: invalid json
137-
data: {"incomplete":
154+
data: {"incomplete":
138155
data: {"candidates":[{"content":{"parts":[{"text":"Valid"}]}}]}
139156
140157
`

src/test-scripts/g_cli_provider/phase4_main_provider/provider_interface.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ describe("Phase 4: Provider Interface", () => {
172172
it("should validate model availability", async () => {
173173
if (provider) {
174174
const models = await provider.getModels()
175-
const modelIds = models.map((m) => m.id)
175+
const modelIds = models.map((m: any) => m.id)
176176

177177
// Should include expected models
178178
expect(modelIds).toContain("gemini-2.5-pro")
@@ -189,8 +189,8 @@ describe("Phase 4: Provider Interface", () => {
189189
it("should provide accurate model specifications", async () => {
190190
if (provider) {
191191
const models = await provider.getModels()
192-
const proModel = models.find((m) => m.id === "gemini-2.5-pro")
193-
const flashModel = models.find((m) => m.id === "gemini-2.5-flash")
192+
const proModel = models.find((m: any) => m.id === "gemini-2.5-pro")
193+
const flashModel = models.find((m: any) => m.id === "gemini-2.5-flash")
194194

195195
// Verify Pro model specs
196196
expect(proModel?.maxTokens).toBe(8192)

src/test-scripts/g_cli_provider/phase4_main_provider/streaming_response.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -483,7 +483,7 @@ describe("Phase 4: Streaming Response", () => {
483483
if (provider) {
484484
mockApiClient.streamGenerateContent.mockImplementation(async function* () {
485485
yield { candidates: [{ content: { parts: [{ text: "Start" }] } }] }
486-
const networkError = new Error("Network error")
486+
const networkError = new Error("Network error") as NodeJS.ErrnoException
487487
networkError.code = "ECONNRESET"
488488
throw networkError
489489
})

src/test-scripts/g_cli_provider/phase5_system_integration/backward_compatibility.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -479,7 +479,7 @@ describe("Phase 5: Backward Compatibility", () => {
479479
// Should have required schema properties
480480
for (const [key, schema] of Object.entries(gCliProviderSettings)) {
481481
expect(schema).toHaveProperty("type")
482-
expect(typeof schema.type).toBe("string")
482+
expect(typeof (schema as any).type).toBe("string")
483483
}
484484

485485
console.log("✅ Settings system compatibility working")

src/test-scripts/g_cli_provider/phase5_system_integration/factory_registration.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -250,7 +250,7 @@ describe("Phase 5: Factory Registration", () => {
250250
expect(Array.isArray(models)).toBe(true)
251251
expect(models.length).toBeGreaterThan(0)
252252

253-
const proModel = models.find((m) => m.id === "gemini-2.5-pro")
253+
const proModel = models.find((m: any) => m.id === "gemini-2.5-pro")
254254
expect(proModel).toBeDefined()
255255
expect(proModel.name).toBe("Gemini 2.5 Pro")
256256
expect(proModel.maxTokens).toBe(8192)

src/test-scripts/g_cli_provider/phase5_system_integration/provider_settings.test.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ describe("Phase 5: Provider Settings", () => {
196196
for (const settings of invalidSettings) {
197197
const result = validateGCliSettings(settings)
198198
expect(result.valid).toBe(false)
199-
expect(result.errors.some((e) => e.field === "projectId")).toBe(true)
199+
expect(result.errors.some((e: any) => e.field === "projectId")).toBe(true)
200200
}
201201

202202
console.log("✅ ProjectId validation working")
@@ -221,7 +221,7 @@ describe("Phase 5: Provider Settings", () => {
221221

222222
const result = validateGCliSettings(invalidSettings)
223223
expect(result.valid).toBe(false)
224-
expect(result.errors.some((e) => e.field === "region")).toBe(true)
224+
expect(result.errors.some((e: any) => e.field === "region")).toBe(true)
225225

226226
console.log("✅ Region validation working")
227227
} catch (error: any) {
@@ -248,7 +248,7 @@ describe("Phase 5: Provider Settings", () => {
248248
for (const settings of invalidTimeouts) {
249249
const result = validateGCliSettings(settings)
250250
expect(result.valid).toBe(false)
251-
expect(result.errors.some((e) => e.field === "timeout")).toBe(true)
251+
expect(result.errors.some((e: any) => e.field === "timeout")).toBe(true)
252252
}
253253

254254
console.log("✅ Timeout validation working")
@@ -307,7 +307,7 @@ describe("Phase 5: Provider Settings", () => {
307307
"g-cli.region": "europe-west1",
308308
"g-cli.timeout": 45000,
309309
}
310-
return settings[key]
310+
return settings[key as keyof typeof settings]
311311
}),
312312
}
313313

@@ -465,11 +465,11 @@ describe("Phase 5: Provider Settings", () => {
465465
expect(Array.isArray(examples)).toBe(true)
466466
expect(examples.length).toBeGreaterThan(0)
467467

468-
const basicExample = examples.find((e) => e.name === "basic")
468+
const basicExample = examples.find((e: any) => e.name === "basic")
469469
expect(basicExample).toBeDefined()
470470
expect(basicExample.settings.projectId).toBeDefined()
471471

472-
const advancedExample = examples.find((e) => e.name === "advanced")
472+
const advancedExample = examples.find((e: any) => e.name === "advanced")
473473
expect(advancedExample).toBeDefined()
474474
expect(advancedExample.settings.retryAttempts).toBeDefined()
475475

0 commit comments

Comments
 (0)