2021-03-16 22:00:08 +01:00
|
|
|
import migration42 from './042';
|
2020-04-22 19:11:36 +02:00
|
|
|
|
2021-09-21 18:28:13 +02:00
|
|
|
describe('migration #42', () => {
|
|
|
|
it('should update the version metadata', async () => {
|
2020-04-22 19:11:36 +02:00
|
|
|
const oldStorage = {
|
2020-11-03 00:41:28 +01:00
|
|
|
meta: {
|
|
|
|
version: 41,
|
2020-04-22 19:11:36 +02:00
|
|
|
},
|
2020-11-03 00:41:28 +01:00
|
|
|
data: {},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2020-04-22 19:11:36 +02:00
|
|
|
|
2021-09-21 18:28:13 +02:00
|
|
|
const newStorage = await migration42.migrate(oldStorage);
|
|
|
|
expect(newStorage.meta.version).toStrictEqual(42);
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
2020-04-22 19:11:36 +02:00
|
|
|
|
2021-09-21 18:28:13 +02:00
|
|
|
it('should set connectedStatusPopoverHasBeenShown to false', async () => {
|
2020-04-22 19:11:36 +02:00
|
|
|
const oldStorage = {
|
|
|
|
meta: {},
|
|
|
|
data: {
|
|
|
|
AppStateController: {
|
|
|
|
connectedStatusPopoverHasBeenShown: true,
|
|
|
|
bar: 'baz',
|
|
|
|
},
|
|
|
|
foo: 'bar',
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2020-04-22 19:11:36 +02:00
|
|
|
|
2021-09-21 18:28:13 +02:00
|
|
|
const newStorage = await migration42.migrate(oldStorage);
|
|
|
|
expect(newStorage.data).toStrictEqual({
|
|
|
|
AppStateController: {
|
|
|
|
connectedStatusPopoverHasBeenShown: false,
|
|
|
|
bar: 'baz',
|
|
|
|
},
|
|
|
|
foo: 'bar',
|
|
|
|
});
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
2020-04-22 19:11:36 +02:00
|
|
|
|
2021-09-21 18:28:13 +02:00
|
|
|
it('should initialize AppStateController if it does not exist', async () => {
|
2020-04-22 19:11:36 +02:00
|
|
|
const oldStorage = {
|
|
|
|
meta: {},
|
|
|
|
data: {
|
|
|
|
foo: 'bar',
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2020-04-22 19:11:36 +02:00
|
|
|
|
2021-09-21 18:28:13 +02:00
|
|
|
const newStorage = await migration42.migrate(oldStorage);
|
|
|
|
expect(newStorage.data).toStrictEqual({
|
|
|
|
foo: 'bar',
|
|
|
|
AppStateController: {
|
|
|
|
connectedStatusPopoverHasBeenShown: false,
|
|
|
|
},
|
|
|
|
});
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
|
|
|
});
|