2020-04-27 20:53:43 +02:00
|
|
|
import { strict as assert } from 'assert'
|
|
|
|
import migration44 from '../../../app/scripts/migrations/044'
|
|
|
|
|
|
|
|
describe('migration #44', function () {
|
|
|
|
it('should update the version metadata', async function () {
|
|
|
|
const oldStorage = {
|
2020-11-03 00:41:28 +01:00
|
|
|
meta: {
|
|
|
|
version: 43,
|
2020-04-27 20:53:43 +02:00
|
|
|
},
|
2020-11-03 00:41:28 +01:00
|
|
|
data: {},
|
2020-04-27 20:53:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
const newStorage = await migration44.migrate(oldStorage)
|
|
|
|
assert.deepEqual(newStorage.meta, {
|
2020-11-03 00:41:28 +01:00
|
|
|
version: 44,
|
2020-04-27 20:53:43 +02:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should delete mkrMigrationReminderTimestamp state', async function () {
|
|
|
|
const oldStorage = {
|
|
|
|
meta: {},
|
|
|
|
data: {
|
|
|
|
AppStateController: {
|
|
|
|
mkrMigrationReminderTimestamp: 'some timestamp',
|
|
|
|
bar: 'baz',
|
|
|
|
},
|
|
|
|
foo: 'bar',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
const newStorage = await migration44.migrate(oldStorage)
|
|
|
|
assert.deepEqual(newStorage.data, {
|
|
|
|
AppStateController: {
|
|
|
|
bar: 'baz',
|
|
|
|
},
|
|
|
|
foo: 'bar',
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should delete mkrMigrationReminderTimestamp state if it is null', async function () {
|
|
|
|
const oldStorage = {
|
|
|
|
meta: {},
|
|
|
|
data: {
|
|
|
|
AppStateController: {
|
|
|
|
mkrMigrationReminderTimestamp: null,
|
|
|
|
bar: 'baz',
|
|
|
|
},
|
|
|
|
foo: 'bar',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
const newStorage = await migration44.migrate(oldStorage)
|
|
|
|
assert.deepEqual(newStorage.data, {
|
|
|
|
AppStateController: {
|
|
|
|
bar: 'baz',
|
|
|
|
},
|
|
|
|
foo: 'bar',
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
it('should do nothing if mkrMigrationReminderTimestamp state does not exist', async function () {
|
|
|
|
const oldStorage = {
|
|
|
|
meta: {},
|
|
|
|
data: {
|
|
|
|
AppStateController: {
|
|
|
|
bar: 'baz',
|
|
|
|
},
|
|
|
|
foo: 'bar',
|
|
|
|
},
|
|
|
|
}
|
|
|
|
|
|
|
|
const newStorage = await migration44.migrate(oldStorage)
|
|
|
|
assert.deepEqual(oldStorage.data, newStorage.data)
|
|
|
|
})
|
|
|
|
})
|