1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Fix migration 026 to produce the correct shape for state.identities

This commit is contained in:
Whymarrh Whitby 2018-05-17 13:35:38 -02:30
parent e546f4b904
commit 67310e151e
2 changed files with 10 additions and 3 deletions

View File

@ -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
}

View File

@ -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()