Skip to content

Commit 39aac40

Browse files
HappyLiang12edelauna
authored andcommitted
🐛 fix: replace setTimeout(100) with waitUntilReady() and remove dead code (#632)
1 parent 0b3ab5c commit 39aac40

2 files changed

Lines changed: 5 additions & 8 deletions

File tree

apps/vscode-e2e/src/suite/providers/zai.test.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ function installZAiFetchInterceptor(
3535
passthrough?: boolean,
3636
): () => void {
3737
const original = globalThis.fetch
38-
const capturedRequests: Array<{ maxTokens?: number }> = []
3938

4039
globalThis.fetch = async function (input: RequestInfo | URL, init?: RequestInit): Promise<Response> {
4140
const url = typeof input === "string" ? input : input instanceof URL ? input.href : (input as Request).url
@@ -48,8 +47,6 @@ function installZAiFetchInterceptor(
4847
})
4948
: {}
5049

51-
capturedRequests.push({ maxTokens: body.max_tokens })
52-
5350
if (capture) {
5451
capture.maxTokens = body.max_tokens
5552
}

src/services/mcp/__tests__/McpHub.spec.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2128,7 +2128,7 @@ describe("McpHub", () => {
21282128
const mcpHub = new McpHub(mockProvider as ClineProvider)
21292129

21302130
// Wait for initialization
2131-
await new Promise((resolve) => setTimeout(resolve, 100))
2131+
await mcpHub.waitUntilReady()
21322132

21332133
// Verify StdioClientTransport was called with wrapped command
21342134
expect(StdioClientTransport).toHaveBeenCalledWith(
@@ -2192,7 +2192,7 @@ describe("McpHub", () => {
21922192
const mcpHub = new McpHub(mockProvider as ClineProvider)
21932193

21942194
// Wait for initialization
2195-
await new Promise((resolve) => setTimeout(resolve, 100))
2195+
await mcpHub.waitUntilReady()
21962196

21972197
// Verify StdioClientTransport was called without wrapping
21982198
expect(StdioClientTransport).toHaveBeenCalledWith(
@@ -2256,7 +2256,7 @@ describe("McpHub", () => {
22562256
const mcpHub = new McpHub(mockProvider as ClineProvider)
22572257

22582258
// Wait for initialization
2259-
await new Promise((resolve) => setTimeout(resolve, 100))
2259+
await mcpHub.waitUntilReady()
22602260

22612261
// Verify StdioClientTransport was called without double-wrapping
22622262
expect(StdioClientTransport).toHaveBeenCalledWith(
@@ -2333,7 +2333,7 @@ describe("McpHub", () => {
23332333
const mcpHub = new McpHub(mockProvider as ClineProvider)
23342334

23352335
// Wait for initialization
2336-
await new Promise((resolve) => setTimeout(resolve, 100))
2336+
await mcpHub.waitUntilReady()
23372337

23382338
// Verify that the command was wrapped with cmd.exe
23392339
expect(StdioClientTransport).toHaveBeenCalledWith(
@@ -2402,7 +2402,7 @@ describe("McpHub", () => {
24022402
const mcpHub = new McpHub(mockProvider as ClineProvider)
24032403

24042404
// Wait for initialization
2405-
await new Promise((resolve) => setTimeout(resolve, 100))
2405+
await mcpHub.waitUntilReady()
24062406

24072407
// Verify StdioClientTransport was called without double-wrapping
24082408
expect(StdioClientTransport).toHaveBeenCalledWith(

0 commit comments

Comments
 (0)