From 422b4c8ed420fa68033c0d7516cdc96ad75a7b8b Mon Sep 17 00:00:00 2001 From: Maha Benzekri Date: Wed, 15 Jan 2025 12:43:03 +0100 Subject: [PATCH] unit test added --- tests/unit/RoleCredentials.js | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/tests/unit/RoleCredentials.js b/tests/unit/RoleCredentials.js index 261ff6d7a..80ce4ea42 100644 --- a/tests/unit/RoleCredentials.js +++ b/tests/unit/RoleCredentials.js @@ -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', @@ -172,9 +172,9 @@ describe('Credentials Manager', () => { } } ]; - + let completedTests = 0; - + testCases.forEach(testCase => { const mockVaultClient = { assumeRoleBackbeat: (roleArn, roleSessionName, options, callback) => { @@ -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(); } @@ -206,8 +206,7 @@ describe('Credentials Manager', () => { }); }); }); - - + it('RoleCredentials should use a default renewal anticipation delay if not explicit', () => { const vaultclient = new Client(