@@ -838,27 +838,45 @@ describe('AmazonQTokenServiceManager', () => {
838838 } )
839839
840840 describe ( 'Connection types with no Developer Profiles support' , ( ) => {
841- it ( 'returns error when profile update is requested and connection type is none ' , async ( ) => {
841+ it ( 'handles reauthentication scenario when connection type is none but profile ARN is provided ' , async ( ) => {
842842 setupServiceManager ( true )
843843 clearCredentials ( )
844844
845845 assert . strictEqual ( amazonQTokenServiceManager . getState ( ) , 'PENDING_CONNECTION' )
846+ assert . strictEqual ( amazonQTokenServiceManager . getConnectionType ( ) , 'none' )
846847
847- await assert . rejects (
848- amazonQTokenServiceManager . handleOnUpdateConfiguration (
849- {
850- section : 'aws.q' ,
851- settings : {
852- profileArn : 'arn:aws:testprofilearn:us-east-1:11111111111111:profile/QQQQQQQQQQQQ' ,
853- } ,
848+ await amazonQTokenServiceManager . handleOnUpdateConfiguration (
849+ {
850+ section : 'aws.q' ,
851+ settings : {
852+ profileArn : 'arn:aws:testprofilearn:us-east-1:11111111111111:profile/QQQQQQQQQQQQ' ,
854853 } ,
855- { } as CancellationToken
856- ) ,
857- new ResponseError ( LSPErrorCodes . RequestFailed , 'Amazon Q service is not signed in' , {
858- awsErrorCode : 'E_AMAZON_Q_PENDING_CONNECTION' ,
859- } )
854+ } ,
855+ { } as CancellationToken
860856 )
861857
858+ assert . strictEqual ( amazonQTokenServiceManager . getConnectionType ( ) , 'identityCenter' )
859+ assert . strictEqual ( amazonQTokenServiceManager . getState ( ) , 'INITIALIZED' )
860+ } )
861+
862+ it ( 'ignores null profile when connection type is none' , async ( ) => {
863+ setupServiceManager ( true )
864+ clearCredentials ( )
865+
866+ assert . strictEqual ( amazonQTokenServiceManager . getState ( ) , 'PENDING_CONNECTION' )
867+ assert . strictEqual ( amazonQTokenServiceManager . getConnectionType ( ) , 'none' )
868+
869+ await amazonQTokenServiceManager . handleOnUpdateConfiguration (
870+ {
871+ section : 'aws.q' ,
872+ settings : {
873+ profileArn : null ,
874+ } ,
875+ } ,
876+ { } as CancellationToken
877+ )
878+
879+ assert . strictEqual ( amazonQTokenServiceManager . getConnectionType ( ) , 'none' )
862880 assert . strictEqual ( amazonQTokenServiceManager . getState ( ) , 'PENDING_CONNECTION' )
863881 } )
864882
0 commit comments