@@ -13,12 +13,12 @@ import {
1313} from 'aws-core-vscode/codewhisperer'
1414import {
1515 assertTelemetry ,
16- captureEventOnce ,
1716 getTestWindow ,
1817 SeverityLevel ,
1918 createBuilderIdProfile ,
2019 createSsoProfile ,
2120 createTestAuth ,
21+ captureEventNTimes ,
2222} from 'aws-core-vscode/test'
2323import { Auth , Connection , isAnySsoConnection , isBuilderIdConnection } from 'aws-core-vscode/auth'
2424import { globals , vscodeComponent } from 'aws-core-vscode/shared'
@@ -231,15 +231,13 @@ describe('AuthUtil', async function () {
231231 assert . strictEqual ( auth . activeConnection ?. id , authUtil . conn ?. id )
232232
233233 // Switch to unsupported connection
234- const cwAuthUpdatedConnection = captureEventOnce ( authUtil . secondaryAuth . onDidChangeActiveConnection )
234+ const cwAuthUpdatedConnection = captureEventNTimes ( authUtil . secondaryAuth . onDidChangeActiveConnection , 2 )
235235 await auth . useConnection ( unsupportedConn )
236- // This is triggered when the main Auth connection is switched
236+ // - This is triggered when the main Auth connection is switched
237+ // - This is triggered by registerAuthListener() when it saves the previous active connection as a fallback.
237238 await cwAuthUpdatedConnection
238- // This is triggered by registerAuthListener() when it saves the previous active connection as a fallback.
239- // TODO in a refactor see if we can simplify multiple multiple triggers on the same event.
240- await captureEventOnce ( authUtil . secondaryAuth . onDidChangeActiveConnection )
241239
242- // Is using the fallback connection
240+ // TODO in a refactor see if we can simplify multiple multiple triggers on the same event.
243241 assert . ok ( authUtil . isConnected ( ) )
244242 assert . ok ( authUtil . isUsingSavedConnection )
245243 assert . notStrictEqual ( auth . activeConnection ?. id , authUtil . conn ?. id )
0 commit comments