From 67310e151ea75c7aa4fc00bfd63bf41cd4f2db51 Mon Sep 17 00:00:00 2001 From: Whymarrh Whitby Date: Thu, 17 May 2018 13:35:38 -0230 Subject: Fix migration 026 to produce the correct shape for state.identities --- app/scripts/migrations/026.js | 9 ++++++++- test/unit/migrations/026-test.js | 4 ++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/scripts/migrations/026.js b/app/scripts/migrations/026.js index ef0ed0542..1b8a91a45 100644 --- a/app/scripts/migrations/026.js +++ b/app/scripts/migrations/026.js @@ -34,7 +34,14 @@ function transformState (state) { return state } - state.PreferencesController.identities = state.KeyringController.walletNicknames + state.PreferencesController.identities = Object.keys(state.KeyringController.walletNicknames) + .reduce((identities, address) => { + identities[address] = { + name: state.KeyringController.walletNicknames[address], + address, + } + return identities + }, {}) delete state.KeyringController.walletNicknames return state } diff --git a/test/unit/migrations/026-test.js b/test/unit/migrations/026-test.js index ac0da3fb2..b3f5470cf 100644 --- a/test/unit/migrations/026-test.js +++ b/test/unit/migrations/026-test.js @@ -19,8 +19,8 @@ describe('migration #26', () => { .then((newStorage) => { const identities = newStorage.data.PreferencesController.identities assert.deepEqual(identities, { - '0x1e77e2': 'Test Account 1', - '0x7e57e2': 'Test Account 2', + '0x1e77e2': {name: 'Test Account 1', address: '0x1e77e2'}, + '0x7e57e2': {name: 'Test Account 2', address: '0x7e57e2'}, }) assert.strictEqual(newStorage.data.KeyringController.walletNicknames, undefined) done() -- cgit