1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-29 15:50:28 +01:00
metamask-extension/test/unit/migrations/026-test.js

44 lines
1.3 KiB
JavaScript
Raw Normal View History

import assert from 'assert'
2020-07-18 01:36:29 +02:00
import firstTimeState from '../../../app/scripts/first-time-state'
import migration26 from '../../../app/scripts/migrations/026'
const oldStorage = {
2019-12-03 21:50:55 +01:00
'meta': { 'version': 25 },
'data': {
'PreferencesController': {},
'KeyringController': {
'walletNicknames': {
'0x1e77e2': 'Test Account 1',
'0x7e57e2': 'Test Account 2',
},
},
},
}
describe('migration #26', function () {
it('should move the identities from KeyringController', function (done) {
migration26.migrate(oldStorage)
.then((newStorage) => {
const { identities } = newStorage.data.PreferencesController
assert.deepEqual(identities, {
2019-12-03 21:50:55 +01:00
'0x1e77e2': { name: 'Test Account 1', address: '0x1e77e2' },
'0x7e57e2': { name: 'Test Account 2', address: '0x7e57e2' },
})
assert.strictEqual(newStorage.data.KeyringController.walletNicknames, undefined)
done()
})
.catch(done)
})
it('should successfully migrate first time state', function (done) {
migration26.migrate({
meta: {},
2020-07-18 01:36:29 +02:00
data: firstTimeState,
})
.then((migratedData) => {
assert.equal(migratedData.meta.version, migration26.version)
done()
}).catch(done)
})
})