@@ -201,17 +201,9 @@ suite("Roo Code MCP OAuth", function () {
201201 const rooDir = path . join ( workspaceDir , ".roo" )
202202 await fs . mkdir ( rooDir , { recursive : true } )
203203
204- const mcpConfig = {
205- mcpServers : {
206- "test-oauth-server" : {
207- type : "streamable-http" ,
208- url : `http://localhost:${ mockServerPort } /mcp` ,
209- } ,
210- } ,
211- }
212-
213204 testFiles = { mcpConfig : path . join ( rooDir , "mcp.json" ) }
214- await fs . writeFile ( testFiles . mcpConfig , JSON . stringify ( mcpConfig , null , 2 ) )
205+ // Config is written by each test to control when the connection starts,
206+ // ensuring all endpoint hits are captured after endpointsHit is cleared.
215207
216208 console . log ( "[TEST] Mock server port:" , mockServerPort )
217209 console . log ( "[TEST] MCP config:" , testFiles . mcpConfig )
@@ -272,7 +264,7 @@ suite("Roo Code MCP OAuth", function () {
272264 } )
273265
274266 test ( "Should complete the full OAuth flow when connecting to an OAuth-protected MCP server" , async function ( ) {
275- // Re-write the config to trigger the file watcher and force a reconnect .
267+ // Write the config to trigger the initial connection attempt .
276268 const workspaceDir = vscode . workspace . workspaceFolders ?. [ 0 ] ?. uri . fsPath || tempDir
277269 const mcpConfigPath = path . join ( workspaceDir , ".roo" , "mcp.json" )
278270
@@ -329,13 +321,8 @@ suite("Roo Code MCP OAuth", function () {
329321 } )
330322
331323 test ( "Should reuse stored token on reconnect without re-running the full OAuth flow" , async function ( ) {
332- // Ensure a token is in SecretStorage before testing reuse — this makes the
333- // test self-contained regardless of execution order.
334- await waitFor ( ( ) => endpointsHit . has ( "token" ) , { timeout : 30_000 } )
335-
336- // Clear hit tracking so we can assert the token endpoint is NOT re-hit.
337- endpointsHit . clear ( )
338-
324+ // Test 1 stored a valid token in SecretStorage. The per-test setup already
325+ // cleared endpointsHit, so any hits here are from this reconnect only.
339326 const workspaceDir = vscode . workspace . workspaceFolders ?. [ 0 ] ?. uri . fsPath || tempDir
340327 const mcpConfigPath = path . join ( workspaceDir , ".roo" , "mcp.json" )
341328
0 commit comments