@@ -89,6 +89,10 @@ describe("fromTemporaryCredentials", () => {
8989 await provider ( ) ;
9090 expect ( vi . mocked ( STSClient as any ) ) . toHaveBeenCalledWith ( {
9191 credentials : masterCredentials ,
92+ logger : void 0 ,
93+ profile : void 0 ,
94+ region : "us-east-1" ,
95+ requestHandler : void 0 ,
9296 } ) ;
9397 expect ( mockUsePlugin ) . toHaveBeenCalledTimes ( 1 ) ;
9498 expect ( mockUsePlugin ) . toHaveBeenNthCalledWith ( 1 , plugin ) ;
@@ -193,6 +197,44 @@ describe("fromTemporaryCredentials", () => {
193197 } ) ;
194198 } ) ;
195199
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+
196238 it ( "should allow assume roles assuming roles assuming roles ad infinitum" , async ( ) => {
197239 const roleArnOf = ( id : string ) => `arn:aws:iam::123456789:role/${ id } ` ;
198240 const idOf = ( roleArn : string ) => roleArn . split ( "/" ) ?. [ 1 ] ?? "UNKNOWN" ;
0 commit comments