aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/scripts/keyring-controller.js5
-rw-r--r--test/unit/keyring-controller-test.js9
2 files changed, 11 insertions, 3 deletions
diff --git a/app/scripts/keyring-controller.js b/app/scripts/keyring-controller.js
index a36f5b752..f93202523 100644
--- a/app/scripts/keyring-controller.js
+++ b/app/scripts/keyring-controller.js
@@ -281,7 +281,7 @@ module.exports = class KeyringController extends EventEmitter {
}
persistAllKeyrings () {
- Promise.all(this.keyrings.map((keyring) => {
+ return Promise.all(this.keyrings.map((keyring) => {
return Promise.all([keyring.type, keyring.serialize()])
.then((serializedKeyringArray) => {
// Label the output values on each serialized Keyring:
@@ -314,13 +314,14 @@ module.exports = class KeyringController extends EventEmitter {
const { type, data } = serialized
const Keyring = this.getKeyringClassForType(type)
const keyring = new Keyring()
- keyring.deserialize(data)
+ return keyring.deserialize(data)
.then(() => {
return keyring.getAccounts()
})
.then((accounts) => {
this.setupAccounts(accounts)
this.keyrings.push(keyring)
+ return keyring
})
}
diff --git a/test/unit/keyring-controller-test.js b/test/unit/keyring-controller-test.js
index d35c8927f..056e465ca 100644
--- a/test/unit/keyring-controller-test.js
+++ b/test/unit/keyring-controller-test.js
@@ -77,10 +77,17 @@ describe('KeyringController', function() {
keyringController.restoreKeyring(mockSerialized)
.then((keyring) => {
assert.equal(keyring.wallets.length, 1, 'one wallet restored')
- assert.equal(keyring.getAccounts()[0], addresses[0])
+ return keyring.getAccounts()
+ })
+ .then((accounts) => {
+ assert.equal(accounts[0], addresses[0])
mock.verify()
done()
})
+ .catch((reason) => {
+ assert.ifError(reason)
+ done()
+ })
})
})