Skip to content

Commit

Permalink
Merge pull request #32 from ansukumari/patch-1
Browse files Browse the repository at this point in the history
Return Instance if instance already booted when calling vault.boot() function.
  • Loading branch information
b1ff authored Jun 7, 2024
2 parents 87dc617 + 147eb2d commit 2615226
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 5 deletions.
5 changes: 1 addition & 4 deletions src/VaultClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,8 @@ class VaultClient {
let instance = vaultInstances[name];
if (instance === undefined) {
vaultInstances[name] = instance = new VaultClient(options);

return instance;
}

throw new errors.InvalidArgumentsError('Instance with such name already booted');
return instance;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion test/unit.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ describe('Unit tests', function () {

expect(VaultClient.get('tst')).to.equal(i);

expect(() => VaultClient.boot('tst', bootOpts)).to.throw(VaultErr.InvalidArgumentsError, 'Instance with such name already booted');
expect(VaultClient.boot('tst')).to.equal(i);


const i2 = VaultClient.boot('tst2', bootOpts);
Expand Down

0 comments on commit 2615226

Please sign in to comment.