@@ -89,6 +89,10 @@ describe("fromTemporaryCredentials", () => {
89
89
await provider ( ) ;
90
90
expect ( vi . mocked ( STSClient as any ) ) . toHaveBeenCalledWith ( {
91
91
credentials : masterCredentials ,
92
+ logger : void 0 ,
93
+ profile : void 0 ,
94
+ region : "us-east-1" ,
95
+ requestHandler : void 0 ,
92
96
} ) ;
93
97
expect ( mockUsePlugin ) . toHaveBeenCalledTimes ( 1 ) ;
94
98
expect ( mockUsePlugin ) . toHaveBeenNthCalledWith ( 1 , plugin ) ;
@@ -193,6 +197,44 @@ describe("fromTemporaryCredentials", () => {
193
197
} ) ;
194
198
} ) ;
195
199
200
+ it ( "uses caller client options if not overridden with provider client options" , async ( ) => {
201
+ const provider = fromTemporaryCredentialsNode ( {
202
+ params : {
203
+ RoleArn,
204
+ RoleSessionName,
205
+ } ,
206
+ } ) ;
207
+ const logger = {
208
+ debug ( ) { } ,
209
+ info ( ) { } ,
210
+ warn ( ) { } ,
211
+ error ( ) { } ,
212
+ } ;
213
+ const credentials = {
214
+ accessKeyId : "" ,
215
+ secretAccessKey : "" ,
216
+ } ;
217
+ const credentialProvider = async ( ) => credentials ;
218
+ const regionProvider = async ( ) => "B" ;
219
+ await provider ( {
220
+ callerClientConfig : {
221
+ profile : "A" ,
222
+ region : regionProvider ,
223
+ logger,
224
+ requestHandler : Symbol . for ( "requestHandler" ) as any ,
225
+ credentialDefaultProvider : ( ) => credentialProvider ,
226
+ } ,
227
+ } ) ;
228
+ expect ( vi . mocked ( STSClient as any ) . mock . calls [ 0 ] [ 0 ] ) . toEqual ( {
229
+ profile : "A" ,
230
+ region : regionProvider ,
231
+ logger,
232
+ requestHandler : Symbol . for ( "requestHandler" ) as any ,
233
+ // mockImpl resolved the credentials.
234
+ credentials,
235
+ } ) ;
236
+ } ) ;
237
+
196
238
it ( "should allow assume roles assuming roles assuming roles ad infinitum" , async ( ) => {
197
239
const roleArnOf = ( id : string ) => `arn:aws:iam::123456789:role/${ id } ` ;
198
240
const idOf = ( roleArn : string ) => roleArn . split ( "/" ) ?. [ 1 ] ?? "UNKNOWN" ;
0 commit comments