2021-02-04 19:15:23 +01:00
|
|
|
import { strict as assert } from 'assert';
|
2021-03-16 22:00:08 +01:00
|
|
|
import migration38 from './038';
|
2019-09-24 23:08:38 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
describe('migration #38', function () {
|
|
|
|
it('should update the version metadata', function (done) {
|
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
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
migration38
|
|
|
|
.migrate(oldStorage)
|
2019-09-24 23:08:38 +02:00
|
|
|
.then((newStorage) => {
|
|
|
|
assert.deepEqual(newStorage.meta, {
|
2020-11-03 00:41:28 +01:00
|
|
|
version: 38,
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
|
|
|
done();
|
2019-09-24 23:08:38 +02:00
|
|
|
})
|
2021-02-04 19:15:23 +01:00
|
|
|
.catch(done);
|
|
|
|
});
|
2019-09-24 23:08:38 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('should add a fullScreenVsPopup property set to either "control" or "fullScreen"', function (done) {
|
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
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
migration38
|
|
|
|
.migrate(oldStorage)
|
2019-09-24 23:08:38 +02:00
|
|
|
.then((newStorage) => {
|
2020-11-03 00:41:28 +01:00
|
|
|
assert.equal(
|
|
|
|
newStorage.data.ABTestController.abTests.fullScreenVsPopup,
|
|
|
|
'control',
|
2021-02-04 19:15:23 +01:00
|
|
|
);
|
|
|
|
done();
|
2019-09-24 23:08:38 +02:00
|
|
|
})
|
2021-02-04 19:15:23 +01:00
|
|
|
.catch(done);
|
|
|
|
});
|
2019-09-24 23:08:38 +02:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('should leave the fullScreenVsPopup property unchanged if it exists', function (done) {
|
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
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
migration38
|
|
|
|
.migrate(oldStorage)
|
2019-09-24 23:08:38 +02:00
|
|
|
.then((newStorage) => {
|
|
|
|
assert.deepEqual(newStorage.data.ABTestController, {
|
|
|
|
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
|
|
|
});
|
|
|
|
done();
|
2019-09-24 23:08:38 +02:00
|
|
|
})
|
2021-02-04 19:15:23 +01:00
|
|
|
.catch(done);
|
|
|
|
});
|
|
|
|
});
|