From e0246975a7a40a72cc68fb3dbe5782c9c219fea2 Mon Sep 17 00:00:00 2001 From: Dan Finlay Date: Thu, 3 Nov 2016 13:44:29 -0700 Subject: Finish fixing nicknaming bug --- test/unit/keyring-controller-test.js | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) (limited to 'test/unit/keyring-controller-test.js') diff --git a/test/unit/keyring-controller-test.js b/test/unit/keyring-controller-test.js index eed6af2c3..0076d9ebe 100644 --- a/test/unit/keyring-controller-test.js +++ b/test/unit/keyring-controller-test.js @@ -115,7 +115,38 @@ describe('KeyringController', function() { const persisted = keyringController.configManager.nicknameForWallet(account) assert.equal(persisted, nick) }) + + this.timeout(10000) + it('retrieves the persisted nickname', function(done) { + const account = addresses[0] + var nick = 'Test nickname' + keyringController.configManager.setNicknameForWallet(account, nick) + console.log('calling to restore') + keyringController.createNewVaultAndRestore(password, seedWords, (err, state) => { + console.dir({err}) + assert.ifError(err) + + const identity = keyringController.identities['0x' + account] + assert.equal(identity.name, nick) + + assert(accounts) + done() + }) + }) }) + + describe('#getAccounts', function() { + it('returns the result of getAccounts for each keyring', function() { + keyringController.keyrings = [ + { getAccounts() { return [1,2,3] } }, + { getAccounts() { return [4,5,6] } }, + ] + + const result = keyringController.getAccounts() + assert.deepEqual(result, [1,2,3,4,5,6]) + }) + }) + }) -- cgit