2021-03-16 22:00:08 +01:00
|
|
|
import migrationTemplate from './030';
|
2020-01-09 04:34:58 +01:00
|
|
|
|
2019-01-17 20:10:33 +01:00
|
|
|
const storage = {
|
|
|
|
meta: {},
|
|
|
|
data: {
|
|
|
|
NetworkController: {
|
|
|
|
network: 'fail',
|
|
|
|
provider: {
|
|
|
|
chainId: 'fail',
|
|
|
|
nickname: '',
|
|
|
|
rpcTarget: 'https://api.myetherwallet.com/eth',
|
|
|
|
ticker: 'ETH',
|
|
|
|
type: 'rinkeby',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
PreferencesController: {
|
|
|
|
frequentRpcListDetail: [
|
2020-11-03 00:41:28 +01:00
|
|
|
{
|
|
|
|
chainId: 'fail',
|
|
|
|
nickname: '',
|
|
|
|
rpcUrl: 'http://127.0.0.1:8545',
|
|
|
|
ticker: '',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
chainId: '1',
|
|
|
|
nickname: '',
|
|
|
|
rpcUrl: 'https://api.myetherwallet.com/eth',
|
|
|
|
ticker: 'ETH',
|
|
|
|
},
|
2019-01-17 20:10:33 +01:00
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2019-01-17 20:10:33 +01:00
|
|
|
|
2021-09-21 18:28:13 +02:00
|
|
|
describe('storage is migrated successfully', () => {
|
|
|
|
it('should work', async () => {
|
|
|
|
const migratedData = await migrationTemplate.migrate(storage);
|
|
|
|
|
|
|
|
expect(migratedData.meta.version).toStrictEqual(30);
|
|
|
|
expect(
|
|
|
|
migratedData.data.PreferencesController.frequentRpcListDetail[0].chainId,
|
|
|
|
).toBeUndefined();
|
|
|
|
expect(
|
|
|
|
migratedData.data.PreferencesController.frequentRpcListDetail[1].chainId,
|
|
|
|
).toStrictEqual('1');
|
|
|
|
expect(
|
|
|
|
migratedData.data.NetworkController.provider.chainId,
|
|
|
|
).toBeUndefined();
|
|
|
|
expect(migratedData.data.NetworkController.network).toBeUndefined();
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
|
|
|
});
|