@@ -3,6 +3,7 @@ import type { ClineProvider } from "../../../core/webview/ClineProvider"
33import type { ExtensionContext , Uri } from "vscode"
44import { ServerConfigSchema , McpHub } from "../McpHub"
55import fs from "fs/promises"
6+ import { vi , Mock } from "vitest"
67
78vi . mock ( "vscode" , ( ) => ( {
89 workspace : {
@@ -300,12 +301,12 @@ describe("McpHub", () => {
300301 mcpHub . connections = [ mockConnection ]
301302
302303 // Mock reading initial config
303- ; ( fs . readFile as jest . Mock ) . mockResolvedValueOnce ( JSON . stringify ( mockConfig ) )
304+ ; ( fs . readFile as Mock ) . mockResolvedValueOnce ( JSON . stringify ( mockConfig ) )
304305
305306 await mcpHub . toggleToolEnabledForPrompt ( "test-server" , "global" , "new-tool" , false )
306307
307308 // Verify the config was updated correctly
308- const writeCalls = ( fs . writeFile as jest . Mock ) . mock . calls
309+ const writeCalls = ( fs . writeFile as Mock ) . mock . calls
309310 expect ( writeCalls . length ) . toBeGreaterThan ( 0 )
310311
311312 // Find the write call
@@ -347,12 +348,12 @@ describe("McpHub", () => {
347348 mcpHub . connections = [ mockConnection ]
348349
349350 // Mock reading initial config
350- ; ( fs . readFile as jest . Mock ) . mockResolvedValueOnce ( JSON . stringify ( mockConfig ) )
351+ ; ( fs . readFile as Mock ) . mockResolvedValueOnce ( JSON . stringify ( mockConfig ) )
351352
352353 await mcpHub . toggleToolEnabledForPrompt ( "test-server" , "global" , "existing-tool" , true )
353354
354355 // Verify the config was updated correctly
355- const writeCalls = ( fs . writeFile as jest . Mock ) . mock . calls
356+ const writeCalls = ( fs . writeFile as Mock ) . mock . calls
356357 expect ( writeCalls . length ) . toBeGreaterThan ( 0 )
357358
358359 // Find the write call
@@ -393,15 +394,15 @@ describe("McpHub", () => {
393394 mcpHub . connections = [ mockConnection ]
394395
395396 // Mock reading initial config
396- ; ( fs . readFile as jest . Mock ) . mockResolvedValueOnce ( JSON . stringify ( mockConfig ) )
397+ ; ( fs . readFile as Mock ) . mockResolvedValueOnce ( JSON . stringify ( mockConfig ) )
397398
398399 // Call with false because of "true" is default value
399400 await mcpHub . toggleToolEnabledForPrompt ( "test-server" , "global" , "new-tool" , false )
400401
401402 // Verify the config was updated with initialized disabledTools
402403 // Find the write call with the normalized path
403404 const normalizedSettingsPath = "/mock/settings/path/cline_mcp_settings.json"
404- const writeCalls = ( fs . writeFile as jest . Mock ) . mock . calls
405+ const writeCalls = ( fs . writeFile as Mock ) . mock . calls
405406
406407 // Find the write call with the normalized path
407408 const writeCall = writeCalls . find ( ( call ) => call [ 0 ] === normalizedSettingsPath )
0 commit comments