mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-12 12:47:14 +01:00
3ba91df387
* Unifies the filename suffix to .test.js * Display @babel/no-invalid-this rule for tx-controller.test.js * Add test file extension to test:unit:global
76 lines
1.8 KiB
JavaScript
76 lines
1.8 KiB
JavaScript
import { strict as assert } from 'assert';
|
|
import migration44 from '../../../app/scripts/migrations/044';
|
|
|
|
describe('migration #44', function () {
|
|
it('should update the version metadata', async function () {
|
|
const oldStorage = {
|
|
meta: {
|
|
version: 43,
|
|
},
|
|
data: {},
|
|
};
|
|
|
|
const newStorage = await migration44.migrate(oldStorage);
|
|
assert.deepEqual(newStorage.meta, {
|
|
version: 44,
|
|
});
|
|
});
|
|
|
|
it('should delete mkrMigrationReminderTimestamp state', async function () {
|
|
const oldStorage = {
|
|
meta: {},
|
|
data: {
|
|
AppStateController: {
|
|
mkrMigrationReminderTimestamp: 'some timestamp',
|
|
bar: 'baz',
|
|
},
|
|
foo: 'bar',
|
|
},
|
|
};
|
|
|
|
const newStorage = await migration44.migrate(oldStorage);
|
|
assert.deepEqual(newStorage.data, {
|
|
AppStateController: {
|
|
bar: 'baz',
|
|
},
|
|
foo: 'bar',
|
|
});
|
|
});
|
|
|
|
it('should delete mkrMigrationReminderTimestamp state if it is null', async function () {
|
|
const oldStorage = {
|
|
meta: {},
|
|
data: {
|
|
AppStateController: {
|
|
mkrMigrationReminderTimestamp: null,
|
|
bar: 'baz',
|
|
},
|
|
foo: 'bar',
|
|
},
|
|
};
|
|
|
|
const newStorage = await migration44.migrate(oldStorage);
|
|
assert.deepEqual(newStorage.data, {
|
|
AppStateController: {
|
|
bar: 'baz',
|
|
},
|
|
foo: 'bar',
|
|
});
|
|
});
|
|
|
|
it('should do nothing if mkrMigrationReminderTimestamp state does not exist', async function () {
|
|
const oldStorage = {
|
|
meta: {},
|
|
data: {
|
|
AppStateController: {
|
|
bar: 'baz',
|
|
},
|
|
foo: 'bar',
|
|
},
|
|
};
|
|
|
|
const newStorage = await migration44.migrate(oldStorage);
|
|
assert.deepEqual(oldStorage.data, newStorage.data);
|
|
});
|
|
});
|