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

43 lines
993 B
JavaScript
Raw Normal View History

import migration40 from './040';
describe('migration #40', () => {
it('should update the version metadata', async () => {
const oldStorage = {
2020-11-03 00:41:28 +01:00
meta: {
version: 39,
},
2020-11-03 00:41:28 +01:00
data: {},
};
const newStorage = await migration40.migrate(oldStorage);
expect(newStorage.meta?.version).toStrictEqual(40);
});
it('should delete ProviderApprovalController storage key', async () => {
const oldStorage = {
2020-11-03 00:41:28 +01:00
meta: {},
data: {
ProviderApprovalController: {},
foo: 'bar',
},
};
const newStorage = await migration40.migrate(oldStorage);
expect(newStorage.data).toStrictEqual({
foo: 'bar',
});
});
it('should do nothing if no ProviderApprovalController storage key', async () => {
const oldStorage = {
2020-11-03 00:41:28 +01:00
meta: {},
data: { foo: 'bar' },
};
const newStorage = await migration40.migrate(oldStorage);
expect(newStorage.data).toStrictEqual({
foo: 'bar',
});
});
});