2021-05-07 21:38:24 +02:00
|
|
|
import { strict as assert } from 'assert';
|
2021-03-16 22:00:08 +01:00
|
|
|
import migration42 from './042';
|
2020-04-22 19:11:36 +02:00
|
|
|
|
|
|
|
describe('migration #42', function () {
|
|
|
|
it('should update the version metadata', function (done) {
|
|
|
|
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
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
migration42
|
|
|
|
.migrate(oldStorage)
|
2020-04-22 19:11:36 +02:00
|
|
|
.then((newStorage) => {
|
|
|
|
assert.deepEqual(newStorage.meta, {
|
2020-11-03 00:41:28 +01:00
|
|
|
version: 42,
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
|
|
|
done();
|
2020-04-22 19:11:36 +02:00
|
|
|
})
|
2021-02-04 19:15:23 +01:00
|
|
|
.catch(done);
|
|
|
|
});
|
2020-04-22 19:11:36 +02:00
|
|
|
|
|
|
|
it('should set connectedStatusPopoverHasBeenShown to false', function (done) {
|
|
|
|
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
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
migration42
|
|
|
|
.migrate(oldStorage)
|
2020-04-22 19:11:36 +02:00
|
|
|
.then((newStorage) => {
|
|
|
|
assert.deepEqual(newStorage.data, {
|
|
|
|
AppStateController: {
|
|
|
|
connectedStatusPopoverHasBeenShown: false,
|
|
|
|
bar: 'baz',
|
|
|
|
},
|
|
|
|
foo: 'bar',
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
|
|
|
done();
|
2020-04-22 19:11:36 +02:00
|
|
|
})
|
2021-02-04 19:15:23 +01:00
|
|
|
.catch(done);
|
|
|
|
});
|
2020-04-22 19:11:36 +02:00
|
|
|
|
|
|
|
it('should initialize AppStateController if it does not exist', function (done) {
|
|
|
|
const oldStorage = {
|
|
|
|
meta: {},
|
|
|
|
data: {
|
|
|
|
foo: 'bar',
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2020-04-22 19:11:36 +02:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
migration42
|
|
|
|
.migrate(oldStorage)
|
2020-04-22 19:11:36 +02:00
|
|
|
.then((newStorage) => {
|
|
|
|
assert.deepEqual(newStorage.data, {
|
|
|
|
foo: 'bar',
|
|
|
|
AppStateController: {
|
|
|
|
connectedStatusPopoverHasBeenShown: false,
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
|
|
|
done();
|
2020-04-22 19:11:36 +02:00
|
|
|
})
|
2021-02-04 19:15:23 +01:00
|
|
|
.catch(done);
|
|
|
|
});
|
|
|
|
});
|