2021-03-16 22:00:08 +01:00
|
|
|
import migration38 from './038';
|
2019-09-24 23:08:38 +02:00
|
|
|
|
2021-09-21 18:28:13 +02:00
|
|
|
describe('migration #38', () => {
|
|
|
|
it('should update the version metadata', async () => {
|
2019-09-24 23:08:38 +02:00
|
|
|
const oldStorage = {
|
2020-11-03 00:41:28 +01:00
|
|
|
meta: {
|
|
|
|
version: 37,
|
2019-09-24 23:08:38 +02:00
|
|
|
},
|
2020-11-03 00:41:28 +01:00
|
|
|
data: {},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2019-09-24 23:08:38 +02:00
|
|
|
|
2021-09-21 18:28:13 +02:00
|
|
|
const newStorage = await migration38.migrate(oldStorage);
|
|
|
|
expect(newStorage.meta.version).toStrictEqual(38);
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
2019-09-24 23:08:38 +02:00
|
|
|
|
2021-09-21 18:28:13 +02:00
|
|
|
it('should add a fullScreenVsPopup property set to either "control" or "fullScreen"', async () => {
|
2019-09-24 23:08:38 +02:00
|
|
|
const oldStorage = {
|
2020-11-03 00:41:28 +01:00
|
|
|
meta: {},
|
|
|
|
data: {},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2019-09-24 23:08:38 +02:00
|
|
|
|
2021-09-21 18:28:13 +02:00
|
|
|
const newStorage = await migration38.migrate(oldStorage);
|
|
|
|
expect(
|
|
|
|
newStorage.data.ABTestController?.abTests?.fullScreenVsPopup,
|
|
|
|
).toStrictEqual('control');
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
2019-09-24 23:08:38 +02:00
|
|
|
|
2021-09-21 18:28:13 +02:00
|
|
|
it('should leave the fullScreenVsPopup property unchanged if it exists', async () => {
|
2019-09-24 23:08:38 +02:00
|
|
|
const oldStorage = {
|
2020-11-03 00:41:28 +01:00
|
|
|
meta: {},
|
|
|
|
data: {
|
|
|
|
ABTestController: {
|
2019-09-24 23:08:38 +02:00
|
|
|
abTests: {
|
2020-11-03 00:41:28 +01:00
|
|
|
fullScreenVsPopup: 'fullScreen',
|
2019-09-24 23:08:38 +02:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2019-09-24 23:08:38 +02:00
|
|
|
|
2021-09-21 18:28:13 +02:00
|
|
|
const newStorage = await migration38.migrate(oldStorage);
|
|
|
|
expect(
|
|
|
|
newStorage.data.ABTestController?.abTests?.fullScreenVsPopup,
|
|
|
|
).toStrictEqual('fullScreen');
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
|
|
|
});
|