diff --git a/index.js b/index.js index 5f92493b..f964680e 100644 --- a/index.js +++ b/index.js @@ -80,7 +80,7 @@ class KeyringController extends EventEmitter { async createNewVaultAndKeychain(password) { await this.createFirstKeyTree(password); await this.persistAllKeyrings(password); - this.setUnlocked.bind(); + this.setUnlocked(); this.fullUpdate(); } diff --git a/test/index.js b/test/index.js index 35d8000e..775fd9ba 100644 --- a/test/index.js +++ b/test/index.js @@ -85,7 +85,7 @@ describe('KeyringController', function () { }); describe('createNewVaultAndKeychain', function () { - it('should set a vault on the configManager', async function () { + it('should create a new vault', async function () { keyringController.store.updateState({ vault: null }); assert(!keyringController.store.getState().vault, 'no previous vault'); @@ -95,6 +95,15 @@ describe('KeyringController', function () { expect(vault).toBeTruthy(); }); + it('should unlock the vault', async function () { + keyringController.store.updateState({ vault: null }); + assert(!keyringController.store.getState().vault, 'no previous vault'); + + await keyringController.createNewVaultAndKeychain(password); + const { isUnlocked } = keyringController.memStore.getState(); + expect(isUnlocked).toBe(true); + }); + it('should encrypt keyrings with the correct password each time they are persisted', async function () { keyringController.store.updateState({ vault: null }); assert(!keyringController.store.getState().vault, 'no previous vault');