2021-03-16 22:00:08 +01:00
|
|
|
import migration44 from './044';
|
2020-04-27 20:53:43 +02:00
|
|
|
|
2021-09-21 18:28:13 +02:00
|
|
|
describe('migration #44', () => {
|
|
|
|
it('should update the version metadata', async () => {
|
2020-04-27 20:53:43 +02:00
|
|
|
const oldStorage = {
|
2020-11-03 00:41:28 +01:00
|
|
|
meta: {
|
|
|
|
version: 43,
|
2020-04-27 20:53:43 +02:00
|
|
|
},
|
2020-11-03 00:41:28 +01:00
|
|
|
data: {},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2020-04-27 20:53:43 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
const newStorage = await migration44.migrate(oldStorage);
|
2021-09-21 18:28:13 +02:00
|
|
|
expect(newStorage.meta).toStrictEqual({
|
2020-11-03 00:41:28 +01:00
|
|
|
version: 44,
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
|
|
|
});
|
2020-04-27 20:53:43 +02:00
|
|
|
|
2021-09-21 18:28:13 +02:00
|
|
|
it('should delete mkrMigrationReminderTimestamp state', async () => {
|
2020-04-27 20:53:43 +02:00
|
|
|
const oldStorage = {
|
|
|
|
meta: {},
|
|
|
|
data: {
|
|
|
|
AppStateController: {
|
|
|
|
mkrMigrationReminderTimestamp: 'some timestamp',
|
|
|
|
bar: 'baz',
|
|
|
|
},
|
|
|
|
foo: 'bar',
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2020-04-27 20:53:43 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
const newStorage = await migration44.migrate(oldStorage);
|
2021-09-21 18:28:13 +02:00
|
|
|
expect(newStorage.data).toStrictEqual({
|
2020-04-27 20:53:43 +02:00
|
|
|
AppStateController: {
|
|
|
|
bar: 'baz',
|
|
|
|
},
|
|
|
|
foo: 'bar',
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
|
|
|
});
|
2020-04-27 20:53:43 +02:00
|
|
|
|
2021-09-21 18:28:13 +02:00
|
|
|
it('should delete mkrMigrationReminderTimestamp state if it is null', async () => {
|
2020-04-27 20:53:43 +02:00
|
|
|
const oldStorage = {
|
|
|
|
meta: {},
|
|
|
|
data: {
|
|
|
|
AppStateController: {
|
|
|
|
mkrMigrationReminderTimestamp: null,
|
|
|
|
bar: 'baz',
|
|
|
|
},
|
|
|
|
foo: 'bar',
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2020-04-27 20:53:43 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
const newStorage = await migration44.migrate(oldStorage);
|
2021-09-21 18:28:13 +02:00
|
|
|
expect(newStorage.data).toStrictEqual({
|
2020-04-27 20:53:43 +02:00
|
|
|
AppStateController: {
|
|
|
|
bar: 'baz',
|
|
|
|
},
|
|
|
|
foo: 'bar',
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
|
|
|
});
|
2020-04-27 20:53:43 +02:00
|
|
|
|
2021-09-21 18:28:13 +02:00
|
|
|
it('should do nothing if mkrMigrationReminderTimestamp state does not exist', async () => {
|
2020-04-27 20:53:43 +02:00
|
|
|
const oldStorage = {
|
|
|
|
meta: {},
|
|
|
|
data: {
|
|
|
|
AppStateController: {
|
|
|
|
bar: 'baz',
|
|
|
|
},
|
|
|
|
foo: 'bar',
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2020-04-27 20:53:43 +02:00
|
|
|
|
2021-02-04 19:15:23 +01:00
|
|
|
const newStorage = await migration44.migrate(oldStorage);
|
2021-09-21 18:28:13 +02:00
|
|
|
expect(oldStorage.data).toStrictEqual(newStorage.data);
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
|
|
|
});
|