@@ -570,6 +570,47 @@ describe('Auth', function () {
570
570
assert . strictEqual ( ( await promptForConnection ( auth ) ) ?. id , conn . id )
571
571
} )
572
572
573
+ it ( 'shows a second quickPick for linked IAM profiles when selecting an SSO connection' , async function ( ) {
574
+ let quickPickCount = 0
575
+ getTestWindow ( ) . onDidShowQuickPick ( async ( picker ) => {
576
+ await picker . untilReady ( )
577
+ quickPickCount ++
578
+
579
+ if ( quickPickCount === 1 ) {
580
+ // First picker: select the SSO connection
581
+ const connItem = picker . findItemOrThrow ( / I A M I d e n t i t y C e n t e r / )
582
+ picker . acceptItem ( connItem )
583
+ } else if ( quickPickCount === 2 ) {
584
+ // Second picker: select the linked IAM profile
585
+ const linkedItem = picker . findItemOrThrow ( / T e s t R o l e / )
586
+ picker . acceptItem ( linkedItem )
587
+ }
588
+ } )
589
+
590
+ const linkedSsoProfile = createSsoProfile ( { scopes : scopesSsoAccountAccess } )
591
+ const conn = await auth . createConnection ( linkedSsoProfile )
592
+
593
+ // Mock the SSOClient to return account roles
594
+ auth . ssoClient . listAccounts . returns (
595
+ toCollection ( async function * ( ) {
596
+ yield [ { accountId : '123456789012' } ]
597
+ } )
598
+ )
599
+ auth . ssoClient . listAccountRoles . callsFake ( ( ) =>
600
+ toCollection ( async function * ( ) {
601
+ yield [ { accountId : '123456789012' , roleName : 'TestRole' } ]
602
+ } )
603
+ )
604
+
605
+ // Should get a linked IAM profile back, not the SSO connection
606
+ const result = await promptForConnection ( auth )
607
+ assert . ok ( isIamConnection ( result || undefined ) , 'Expected an IAM connection to be returned' )
608
+ assert . ok (
609
+ result ?. id . startsWith ( `sso:${ conn . id } #` ) ,
610
+ 'Expected the IAM connection to be linked to the SSO connection'
611
+ )
612
+ } )
613
+
573
614
it ( 'refreshes when clicking the refresh button' , async function ( ) {
574
615
getTestWindow ( ) . onDidShowQuickPick ( async ( picker ) => {
575
616
await picker . untilReady ( )
0 commit comments