2021-03-16 22:00:08 +01:00
|
|
|
import firstTimeState from '../first-time-state';
|
|
|
|
import migration26 from './026';
|
2020-01-09 04:34:58 +01:00
|
|
|
|
2018-04-19 05:33:51 +02:00
|
|
|
const oldStorage = {
|
2020-11-03 00:41:28 +01:00
|
|
|
meta: { version: 25 },
|
|
|
|
data: {
|
|
|
|
PreferencesController: {},
|
|
|
|
KeyringController: {
|
|
|
|
walletNicknames: {
|
2018-04-19 05:33:51 +02:00
|
|
|
'0x1e77e2': 'Test Account 1',
|
|
|
|
'0x7e57e2': 'Test Account 2',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2018-04-19 05:33:51 +02:00
|
|
|
|
2021-09-21 18:28:13 +02:00
|
|
|
describe('migration #26', () => {
|
|
|
|
it('should move the identities from KeyringController', async () => {
|
|
|
|
const newStorage = await migration26.migrate(oldStorage);
|
|
|
|
|
|
|
|
const { identities } = newStorage.data.PreferencesController;
|
|
|
|
|
|
|
|
expect(identities).toStrictEqual({
|
|
|
|
'0x1e77e2': { name: 'Test Account 1', address: '0x1e77e2' },
|
|
|
|
'0x7e57e2': { name: 'Test Account 2', address: '0x7e57e2' },
|
|
|
|
});
|
|
|
|
|
|
|
|
expect(newStorage.data.KeyringController.walletNicknames).toBeUndefined();
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
2018-04-19 05:33:51 +02:00
|
|
|
|
2021-09-21 18:28:13 +02:00
|
|
|
it('should successfully migrate first time state', async () => {
|
|
|
|
const migratedData = await migration26.migrate({
|
|
|
|
meta: {},
|
|
|
|
data: firstTimeState,
|
|
|
|
});
|
|
|
|
expect(migratedData.meta.version).toStrictEqual(migration26.version);
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
|
|
|
});
|