You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
67 lines
1.4 KiB
67 lines
1.4 KiB
4 years ago
|
import { strict as assert } from 'assert';
|
||
4 years ago
|
import migration38 from './038';
|
||
5 years ago
|
|
||
5 years ago
|
describe('migration #38', function () {
|
||
|
it('should update the version metadata', function (done) {
|
||
5 years ago
|
const oldStorage = {
|
||
4 years ago
|
meta: {
|
||
|
version: 37,
|
||
5 years ago
|
},
|
||
4 years ago
|
data: {},
|
||
4 years ago
|
};
|
||
5 years ago
|
|
||
4 years ago
|
migration38
|
||
|
.migrate(oldStorage)
|
||
5 years ago
|
.then((newStorage) => {
|
||
|
assert.deepEqual(newStorage.meta, {
|
||
4 years ago
|
version: 38,
|
||
4 years ago
|
});
|
||
|
done();
|
||
5 years ago
|
})
|
||
4 years ago
|
.catch(done);
|
||
|
});
|
||
5 years ago
|
|
||
5 years ago
|
it('should add a fullScreenVsPopup property set to either "control" or "fullScreen"', function (done) {
|
||
5 years ago
|
const oldStorage = {
|
||
4 years ago
|
meta: {},
|
||
|
data: {},
|
||
4 years ago
|
};
|
||
5 years ago
|
|
||
4 years ago
|
migration38
|
||
|
.migrate(oldStorage)
|
||
5 years ago
|
.then((newStorage) => {
|
||
4 years ago
|
assert.equal(
|
||
|
newStorage.data.ABTestController.abTests.fullScreenVsPopup,
|
||
|
'control',
|
||
4 years ago
|
);
|
||
|
done();
|
||
5 years ago
|
})
|
||
4 years ago
|
.catch(done);
|
||
|
});
|
||
5 years ago
|
|
||
5 years ago
|
it('should leave the fullScreenVsPopup property unchanged if it exists', function (done) {
|
||
5 years ago
|
const oldStorage = {
|
||
4 years ago
|
meta: {},
|
||
|
data: {
|
||
|
ABTestController: {
|
||
5 years ago
|
abTests: {
|
||
4 years ago
|
fullScreenVsPopup: 'fullScreen',
|
||
5 years ago
|
},
|
||
|
},
|
||
|
},
|
||
4 years ago
|
};
|
||
5 years ago
|
|
||
4 years ago
|
migration38
|
||
|
.migrate(oldStorage)
|
||
5 years ago
|
.then((newStorage) => {
|
||
|
assert.deepEqual(newStorage.data.ABTestController, {
|
||
|
abTests: {
|
||
4 years ago
|
fullScreenVsPopup: 'fullScreen',
|
||
5 years ago
|
},
|
||
4 years ago
|
});
|
||
|
done();
|
||
5 years ago
|
})
|
||
4 years ago
|
.catch(done);
|
||
|
});
|
||
|
});
|