2021-05-07 21:38:24 +02:00
|
|
|
import { strict as assert } from 'assert';
|
2021-03-16 22:00:08 +01:00
|
|
|
import migration40 from './040';
|
2020-02-27 05:49:59 +01:00
|
|
|
|
|
|
|
describe('migration #40', function () {
|
|
|
|
it('should update the version metadata', function (done) {
|
|
|
|
const oldStorage = {
|
2020-11-03 00:41:28 +01:00
|
|
|
meta: {
|
|
|
|
version: 39,
|
2020-02-27 05:49:59 +01:00
|
|
|
},
|
2020-11-03 00:41:28 +01:00
|
|
|
data: {},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2020-02-27 05:49:59 +01:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
migration40
|
|
|
|
.migrate(oldStorage)
|
2020-02-27 05:49:59 +01:00
|
|
|
.then((newStorage) => {
|
|
|
|
assert.deepEqual(newStorage.meta, {
|
2020-11-03 00:41:28 +01:00
|
|
|
version: 40,
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
|
|
|
done();
|
2020-02-27 05:49:59 +01:00
|
|
|
})
|
2021-02-04 19:15:23 +01:00
|
|
|
.catch(done);
|
|
|
|
});
|
2020-02-27 05:49:59 +01:00
|
|
|
|
|
|
|
it('should delete ProviderApprovalController storage key', function (done) {
|
|
|
|
const oldStorage = {
|
2020-11-03 00:41:28 +01:00
|
|
|
meta: {},
|
|
|
|
data: {
|
|
|
|
ProviderApprovalController: {},
|
|
|
|
foo: 'bar',
|
2020-02-27 05:49:59 +01:00
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2020-02-27 05:49:59 +01:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
migration40
|
|
|
|
.migrate(oldStorage)
|
2020-02-27 05:49:59 +01:00
|
|
|
.then((newStorage) => {
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.deepEqual(newStorage.data, { foo: 'bar' });
|
|
|
|
done();
|
2020-02-27 05:49:59 +01:00
|
|
|
})
|
2021-02-04 19:15:23 +01:00
|
|
|
.catch(done);
|
|
|
|
});
|
2020-02-27 05:49:59 +01:00
|
|
|
|
|
|
|
it('should do nothing if no ProviderApprovalController storage key', function (done) {
|
|
|
|
const oldStorage = {
|
2020-11-03 00:41:28 +01:00
|
|
|
meta: {},
|
|
|
|
data: { foo: 'bar' },
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2020-02-27 05:49:59 +01:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
migration40
|
|
|
|
.migrate(oldStorage)
|
2020-02-27 05:49:59 +01:00
|
|
|
.then((newStorage) => {
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.deepEqual(newStorage.data, { foo: 'bar' });
|
|
|
|
done();
|
2020-02-27 05:49:59 +01:00
|
|
|
})
|
2021-02-04 19:15:23 +01:00
|
|
|
.catch(done);
|
|
|
|
});
|
|
|
|
});
|