mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-22 09:57:02 +01:00
b9ff4e8798
* Remove the network controller `previousProviderStore` The `previousProvider` network controller state has been replaced with a private internal property. This was only used internally, it did not need to be part of state. This relates to https://github.com/MetaMask/metamask-extension/issues/18303 * Remove redundant tests
92 lines
1.9 KiB
JavaScript
92 lines
1.9 KiB
JavaScript
import { migrate, version } from './085';
|
|
|
|
jest.mock('uuid', () => {
|
|
const actual = jest.requireActual('uuid');
|
|
|
|
return {
|
|
...actual,
|
|
v4: jest.fn(),
|
|
};
|
|
});
|
|
|
|
describe('migration #85', () => {
|
|
it('should update the version metadata', async () => {
|
|
const oldStorage = {
|
|
meta: {
|
|
version: 84,
|
|
},
|
|
data: {},
|
|
};
|
|
|
|
const newStorage = await migrate(oldStorage);
|
|
expect(newStorage.meta).toStrictEqual({
|
|
version,
|
|
});
|
|
});
|
|
|
|
it('should return state unaltered if there is no network controller state', async () => {
|
|
const oldData = {
|
|
other: 'data',
|
|
};
|
|
const oldStorage = {
|
|
meta: {
|
|
version: 84,
|
|
},
|
|
data: oldData,
|
|
};
|
|
|
|
const newStorage = await migrate(oldStorage);
|
|
expect(newStorage.data).toStrictEqual(oldData);
|
|
});
|
|
|
|
it('should return state unaltered if there is no network controller previous provider state', async () => {
|
|
const oldData = {
|
|
other: 'data',
|
|
NetworkController: {
|
|
provider: {
|
|
some: 'provider',
|
|
},
|
|
},
|
|
};
|
|
const oldStorage = {
|
|
meta: {
|
|
version: 84,
|
|
},
|
|
data: oldData,
|
|
};
|
|
|
|
const newStorage = await migrate(oldStorage);
|
|
expect(newStorage.data).toStrictEqual(oldData);
|
|
});
|
|
|
|
it('should remove the previous provider state', async () => {
|
|
const oldData = {
|
|
other: 'data',
|
|
NetworkController: {
|
|
previousProviderStore: {
|
|
example: 'config',
|
|
},
|
|
provider: {
|
|
some: 'provider',
|
|
},
|
|
},
|
|
};
|
|
const oldStorage = {
|
|
meta: {
|
|
version: 84,
|
|
},
|
|
data: oldData,
|
|
};
|
|
|
|
const newStorage = await migrate(oldStorage);
|
|
expect(newStorage.data).toStrictEqual({
|
|
other: 'data',
|
|
NetworkController: {
|
|
provider: {
|
|
some: 'provider',
|
|
},
|
|
},
|
|
});
|
|
});
|
|
});
|