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/062.test.js

80 lines
1.8 KiB
JavaScript
Raw Normal View History

import migration62 from './062';
2021-09-22 17:15:40 +02:00
describe('migration #62', () => {
it('should update the version metadata', async () => {
const oldStorage = {
meta: {
version: 61,
},
data: {},
};
const newStorage = await migration62.migrate(oldStorage);
expect(newStorage.meta).toStrictEqual({
version: 62,
});
});
2021-09-22 17:15:40 +02:00
it('should remove metaMetricsSendCount from MetaMetricsController', async () => {
const oldStorage = {
meta: {},
data: {
MetaMetricsController: {
metaMetricsSendCount: 1,
bar: 'baz',
},
foo: 'bar',
},
};
const newStorage = await migration62.migrate(oldStorage);
expect(newStorage.data).toStrictEqual({
MetaMetricsController: {
bar: 'baz',
},
foo: 'bar',
});
});
2021-09-22 17:15:40 +02:00
it('should remove metaMetricsSendCount from MetaMetricsController (falsey but defined)', async () => {
const oldStorage = {
meta: {},
data: {
MetaMetricsController: {
metaMetricsSendCount: 0,
bar: 'baz',
},
foo: 'bar',
},
};
const newStorage = await migration62.migrate(oldStorage);
expect(newStorage.data).toStrictEqual({
MetaMetricsController: {
bar: 'baz',
},
foo: 'bar',
});
});
2021-09-22 17:15:40 +02:00
it('should not modify MetaMetricsController when metaMetricsSendCount is undefined', async () => {
const oldStorage = {
meta: {},
data: {
MetaMetricsController: {
bar: 'baz',
},
foo: 'bar',
},
};
const newStorage = await migration62.migrate(oldStorage);
expect(newStorage.data).toStrictEqual({
MetaMetricsController: {
bar: 'baz',
},
foo: 'bar',
});
});
});