Make mock stsClient fail when region is missing
Signed-off-by: Lee Chiang Fong <lee_chiang_fong@tech.gov.sg>
This commit is contained in:
@@ -91,6 +91,18 @@ describe('DefaultAwsCredentialsManager', () => {
|
||||
Account: '123456789012',
|
||||
});
|
||||
|
||||
stsMock
|
||||
.on(GetCallerIdentityCommand)
|
||||
.callsFake(async (_input, getClient) => {
|
||||
const client = getClient();
|
||||
const region = await client.config.region();
|
||||
if (!region) {
|
||||
throw new Error('Region is missing');
|
||||
}
|
||||
return {
|
||||
Account: '123456789012',
|
||||
};
|
||||
});
|
||||
stsMock
|
||||
.on(AssumeRoleCommand, {
|
||||
RoleArn: 'arn:aws:iam::111111111111:role/hello',
|
||||
|
||||
Reference in New Issue
Block a user