mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
b1f469d1e2
* Removing metametrics send count tracking * Removing client side Transaction Completed and Canceled events
81 lines
1.8 KiB
JavaScript
81 lines
1.8 KiB
JavaScript
import { strict as assert } from 'assert';
|
|
import migration62 from './062';
|
|
|
|
describe('migration #62', function () {
|
|
it('should update the version metadata', async function () {
|
|
const oldStorage = {
|
|
meta: {
|
|
version: 61,
|
|
},
|
|
data: {},
|
|
};
|
|
|
|
const newStorage = await migration62.migrate(oldStorage);
|
|
assert.deepEqual(newStorage.meta, {
|
|
version: 62,
|
|
});
|
|
});
|
|
|
|
it('should remove metaMetricsSendCount from MetaMetricsController', async function () {
|
|
const oldStorage = {
|
|
meta: {},
|
|
data: {
|
|
MetaMetricsController: {
|
|
metaMetricsSendCount: 1,
|
|
bar: 'baz',
|
|
},
|
|
foo: 'bar',
|
|
},
|
|
};
|
|
|
|
const newStorage = await migration62.migrate(oldStorage);
|
|
assert.deepStrictEqual(newStorage.data, {
|
|
MetaMetricsController: {
|
|
bar: 'baz',
|
|
},
|
|
foo: 'bar',
|
|
});
|
|
});
|
|
|
|
it('should remove metaMetricsSendCount from MetaMetricsController (falsey but defined)', async function () {
|
|
const oldStorage = {
|
|
meta: {},
|
|
data: {
|
|
MetaMetricsController: {
|
|
metaMetricsSendCount: 0,
|
|
bar: 'baz',
|
|
},
|
|
foo: 'bar',
|
|
},
|
|
};
|
|
|
|
const newStorage = await migration62.migrate(oldStorage);
|
|
assert.deepStrictEqual(newStorage.data, {
|
|
MetaMetricsController: {
|
|
bar: 'baz',
|
|
},
|
|
foo: 'bar',
|
|
});
|
|
});
|
|
|
|
it('should not modify MetaMetricsController when metaMetricsSendCount is undefined', async function () {
|
|
const oldStorage = {
|
|
meta: {},
|
|
data: {
|
|
MetaMetricsController: {
|
|
bar: 'baz',
|
|
},
|
|
foo: 'bar',
|
|
},
|
|
};
|
|
|
|
const newStorage = await migration62.migrate(oldStorage);
|
|
assert.deepStrictEqual(newStorage.data, {
|
|
MetaMetricsController: {
|
|
bar: 'baz',
|
|
},
|
|
foo: 'bar',
|
|
});
|
|
});
|
|
});
|