@@ -40,7 +40,7 @@ const tokenId = 'test-token'
40
40
describe ( 'LanguageClientAuth' , ( ) => {
41
41
let client : sinon . SinonStubbedInstance < LanguageClient >
42
42
let auth : LanguageClientAuth
43
- const encryptionKey = Buffer . from ( 'test-key' )
43
+ const encryptionKey = Buffer . from ( 'test-key' . padEnd ( 32 , '0' ) )
44
44
let useDeviceFlowStub : sinon . SinonStub
45
45
46
46
beforeEach ( ( ) => {
@@ -61,6 +61,16 @@ describe('LanguageClientAuth', () => {
61
61
}
62
62
useDeviceFlowStub . returns ( useDeviceFlow ? true : false )
63
63
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
+
64
74
await auth . getSsoToken ( tokenSource , true )
65
75
66
76
sinon . assert . calledOnce ( client . sendRequest )
@@ -94,13 +104,6 @@ describe('LanguageClientAuth', () => {
94
104
await auth . updateSsoProfile ( profileName , startUrl , region , [ 'scope1' ] )
95
105
96
106
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
- } )
104
107
} )
105
108
106
109
it ( 'sends correct IAM profile update parameters' , async ( ) => {
@@ -111,18 +114,6 @@ describe('LanguageClientAuth', () => {
111
114
} )
112
115
113
116
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
- } )
126
117
} )
127
118
} )
128
119
@@ -213,6 +204,21 @@ describe('LanguageClientAuth', () => {
213
204
214
205
describe ( 'getIamCredential' , ( ) => {
215
206
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
+
216
222
await auth . getIamCredential ( profileName , true )
217
223
218
224
sinon . assert . calledOnce ( client . sendRequest )
0 commit comments