@@ -40,7 +40,7 @@ const tokenId = 'test-token'
4040describe ( 'LanguageClientAuth' , ( ) => {
4141 let client : sinon . SinonStubbedInstance < LanguageClient >
4242 let auth : LanguageClientAuth
43- const encryptionKey = Buffer . from ( 'test-key' )
43+ const encryptionKey = Buffer . from ( 'test-key' . padEnd ( 32 , '0' ) )
4444 let useDeviceFlowStub : sinon . SinonStub
4545
4646 beforeEach ( ( ) => {
@@ -61,6 +61,16 @@ describe('LanguageClientAuth', () => {
6161 }
6262 useDeviceFlowStub . returns ( useDeviceFlow ? true : false )
6363
64+ client . sendRequest . resolves ( {
65+ ssoToken : {
66+ id : 'my-id' ,
67+ accessToken : 'my-access-token' ,
68+ } ,
69+ updateCredentialsParams : {
70+ data : 'my-data' ,
71+ } ,
72+ } satisfies GetSsoTokenResult )
73+
6474 await auth . getSsoToken ( tokenSource , true )
6575
6676 sinon . assert . calledOnce ( client . sendRequest )
@@ -94,13 +104,6 @@ describe('LanguageClientAuth', () => {
94104 await auth . updateSsoProfile ( profileName , startUrl , region , [ 'scope1' ] )
95105
96106 sinon . assert . calledOnce ( client . sendRequest )
97- const requestParams = client . sendRequest . firstCall . args [ 1 ]
98- sinon . assert . match ( requestParams . profile , {
99- name : profileName ,
100- } )
101- sinon . assert . match ( requestParams . ssoSession . settings , {
102- sso_region : region ,
103- } )
104107 } )
105108
106109 it ( 'sends correct IAM profile update parameters' , async ( ) => {
@@ -111,18 +114,6 @@ describe('LanguageClientAuth', () => {
111114 } )
112115
113116 sinon . assert . calledOnce ( client . sendRequest )
114- const requestParams = client . sendRequest . firstCall . args [ 1 ]
115- sinon . assert . match ( requestParams . profile , {
116- name : profileName ,
117- kinds : [ ProfileKind . IamCredentialsProfile ] ,
118- } )
119- sinon . assert . match ( requestParams . profile . settings , {
120- aws_access_key_id : 'myAccessKey' ,
121- aws_secret_access_key : 'mySecretKey' ,
122- aws_session_token : 'mySessionToken' ,
123- role_arn : '' ,
124- source_profile : '' ,
125- } )
126117 } )
127118 } )
128119
@@ -213,6 +204,21 @@ describe('LanguageClientAuth', () => {
213204
214205 describe ( 'getIamCredential' , ( ) => {
215206 it ( 'sends correct request parameters' , async ( ) => {
207+ client . sendRequest . resolves ( {
208+ credential : {
209+ id : 'my-id' ,
210+ kinds : [ ] ,
211+ credentials : {
212+ accessKeyId : 'my-access-key' ,
213+ secretAccessKey : 'my-secret-key' ,
214+ sessionToken : 'my-session-token' ,
215+ } ,
216+ } ,
217+ updateCredentialsParams : {
218+ data : 'my-data' ,
219+ } ,
220+ } satisfies GetIamCredentialResult )
221+
216222 await auth . getIamCredential ( profileName , true )
217223
218224 sinon . assert . calledOnce ( client . sendRequest )
0 commit comments