Skip to content

Commit

Permalink
unit test added
Browse files Browse the repository at this point in the history
  • Loading branch information
benzekrimaha committed Jan 15, 2025
1 parent e2a6c8e commit 422b4c8
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions tests/unit/RoleCredentials.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ describe('Credentials Manager', () => {
});
});

it('should properly handle Arsenal and non-Arsenal errors', function(done) {
it('should properly handle Arsenal and non-Arsenal errors', done => {
const testCases = [
{
name: 'non-Arsenal error',
Expand All @@ -172,9 +172,9 @@ describe('Credentials Manager', () => {
}
}
];

let completedTests = 0;

testCases.forEach(testCase => {
const mockVaultClient = {
assumeRoleBackbeat: (roleArn, roleSessionName, options, callback) => {
Expand All @@ -184,19 +184,19 @@ describe('Credentials Manager', () => {
callback(errorWithCode, null, testCase.statusCode);
}
};

const credentials = new RoleCredentials(
mockVaultClient,
role,
extension,
new Logger('test:RoleCredentials').newRequestLogger('request-uid')
);

credentials.refresh(err => {
try {
testCase.expectedResult(err);
completedTests += 1;

if (completedTests === testCases.length) {
done();
}
Expand All @@ -206,8 +206,7 @@ describe('Credentials Manager', () => {
});
});
});




it('RoleCredentials should use a default renewal anticipation delay if not explicit', () => {
const vaultclient = new Client(
Expand Down

0 comments on commit 422b4c8

Please sign in to comment.