2021-05-07 21:38:24 +02:00
|
|
|
import { strict as assert } from 'assert';
|
2021-03-16 22:00:08 +01:00
|
|
|
import migration39 from './039';
|
2019-11-18 22:46:28 +01:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
describe('migration #39', function () {
|
|
|
|
it('should update the version metadata', function (done) {
|
2019-11-18 22:46:28 +01:00
|
|
|
const oldStorage = {
|
2020-11-03 00:41:28 +01:00
|
|
|
meta: {
|
|
|
|
version: 38,
|
2019-11-18 22:46:28 +01:00
|
|
|
},
|
2020-11-03 00:41:28 +01:00
|
|
|
data: {},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2019-11-18 22:46:28 +01:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
migration39
|
|
|
|
.migrate(oldStorage)
|
2019-11-18 22:46:28 +01:00
|
|
|
.then((newStorage) => {
|
|
|
|
assert.deepEqual(newStorage.meta, {
|
2020-11-03 00:41:28 +01:00
|
|
|
version: 39,
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
|
|
|
done();
|
2019-11-18 22:46:28 +01:00
|
|
|
})
|
2021-02-04 19:15:23 +01:00
|
|
|
.catch(done);
|
|
|
|
});
|
2019-11-18 22:46:28 +01:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('should update old DAI token symbol to SAI in tokens', function (done) {
|
2019-11-18 22:46:28 +01:00
|
|
|
const oldStorage = {
|
2020-11-03 00:41:28 +01:00
|
|
|
meta: {},
|
|
|
|
data: {
|
|
|
|
PreferencesController: {
|
|
|
|
tokens: [
|
|
|
|
{
|
|
|
|
address: '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359',
|
|
|
|
decimals: 18,
|
|
|
|
symbol: 'DAI',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
address: '0x0d8775f648430679a709e98d2b0cb6250d2887ef',
|
|
|
|
symbol: 'BAT',
|
|
|
|
decimals: 18,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
address: '0x617b3f8050a0bd94b6b1da02b4384ee5b4df13f4',
|
|
|
|
symbol: 'META',
|
|
|
|
decimals: 18,
|
|
|
|
},
|
|
|
|
],
|
2019-11-18 22:46:28 +01:00
|
|
|
},
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2019-11-18 22:46:28 +01:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
migration39
|
|
|
|
.migrate(oldStorage)
|
2019-11-18 22:46:28 +01:00
|
|
|
.then((newStorage) => {
|
|
|
|
assert.deepEqual(newStorage.data.PreferencesController, {
|
2020-11-03 00:41:28 +01:00
|
|
|
tokens: [
|
|
|
|
{
|
|
|
|
address: '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359',
|
|
|
|
decimals: 18,
|
|
|
|
symbol: 'SAI',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
address: '0x0d8775f648430679a709e98d2b0cb6250d2887ef',
|
|
|
|
symbol: 'BAT',
|
|
|
|
decimals: 18,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
address: '0x617b3f8050a0bd94b6b1da02b4384ee5b4df13f4',
|
|
|
|
symbol: 'META',
|
|
|
|
decimals: 18,
|
|
|
|
},
|
|
|
|
],
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
|
|
|
done();
|
2019-11-18 22:46:28 +01:00
|
|
|
})
|
2021-02-04 19:15:23 +01:00
|
|
|
.catch(done);
|
|
|
|
});
|
2019-11-18 22:46:28 +01:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('should update old DAI token symbol to SAI in accountTokens', function (done) {
|
2019-11-18 22:46:28 +01:00
|
|
|
const oldStorage = {
|
2020-11-03 00:41:28 +01:00
|
|
|
meta: {},
|
|
|
|
data: {
|
|
|
|
PreferencesController: {
|
|
|
|
accountTokens: {
|
2019-11-18 22:46:28 +01:00
|
|
|
'0x7250739de134d33ec7ab1ee592711e15098c9d2d': {
|
2020-11-03 00:41:28 +01:00
|
|
|
mainnet: [
|
2019-11-18 22:46:28 +01:00
|
|
|
{
|
2020-11-03 00:41:28 +01:00
|
|
|
address: '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359',
|
|
|
|
decimals: 18,
|
|
|
|
symbol: 'DAI',
|
2019-11-18 22:46:28 +01:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
'0x8e5d75d60224ea0c33d0041e75de68b1c3cb6dd5': {
|
2020-11-03 00:41:28 +01:00
|
|
|
mainnet: [],
|
|
|
|
rinkeby: [],
|
2019-11-18 22:46:28 +01:00
|
|
|
},
|
|
|
|
'0x8e5d75d60224ea0c33d1041e75de68b1c3cb6dd5': {},
|
|
|
|
'0xb3958fb96c8201486ae20be1d5c9f58083df343a': {
|
2020-11-03 00:41:28 +01:00
|
|
|
mainnet: [
|
2019-11-18 22:46:28 +01:00
|
|
|
{
|
2020-11-03 00:41:28 +01:00
|
|
|
address: '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359',
|
|
|
|
decimals: 18,
|
|
|
|
symbol: 'DAI',
|
2019-11-18 22:46:28 +01:00
|
|
|
},
|
|
|
|
{
|
2020-11-03 00:41:28 +01:00
|
|
|
address: '0x0d8775f648430679a709e98d2b0cb6250d2887ef',
|
|
|
|
decimals: 18,
|
|
|
|
symbol: 'BAT',
|
2019-11-18 22:46:28 +01:00
|
|
|
},
|
|
|
|
{
|
2020-11-03 00:41:28 +01:00
|
|
|
address: '0x617b3f8050a0bd94b6b1da02b4384ee5b4df13f4',
|
|
|
|
decimals: 18,
|
|
|
|
symbol: 'META',
|
2019-11-18 22:46:28 +01:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2019-11-18 22:46:28 +01:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
migration39
|
|
|
|
.migrate(oldStorage)
|
2019-11-18 22:46:28 +01:00
|
|
|
.then((newStorage) => {
|
|
|
|
assert.deepEqual(newStorage.data.PreferencesController, {
|
2020-11-03 00:41:28 +01:00
|
|
|
accountTokens: {
|
2019-11-18 22:46:28 +01:00
|
|
|
'0x7250739de134d33ec7ab1ee592711e15098c9d2d': {
|
2020-11-03 00:41:28 +01:00
|
|
|
mainnet: [
|
2019-11-18 22:46:28 +01:00
|
|
|
{
|
2020-11-03 00:41:28 +01:00
|
|
|
address: '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359',
|
|
|
|
decimals: 18,
|
|
|
|
symbol: 'SAI',
|
2019-11-18 22:46:28 +01:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
'0x8e5d75d60224ea0c33d0041e75de68b1c3cb6dd5': {
|
2020-11-03 00:41:28 +01:00
|
|
|
mainnet: [],
|
|
|
|
rinkeby: [],
|
2019-11-18 22:46:28 +01:00
|
|
|
},
|
|
|
|
'0x8e5d75d60224ea0c33d1041e75de68b1c3cb6dd5': {},
|
|
|
|
'0xb3958fb96c8201486ae20be1d5c9f58083df343a': {
|
2020-11-03 00:41:28 +01:00
|
|
|
mainnet: [
|
2019-11-18 22:46:28 +01:00
|
|
|
{
|
2020-11-03 00:41:28 +01:00
|
|
|
address: '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359',
|
|
|
|
decimals: 18,
|
|
|
|
symbol: 'SAI',
|
2019-11-18 22:46:28 +01:00
|
|
|
},
|
|
|
|
{
|
2020-11-03 00:41:28 +01:00
|
|
|
address: '0x0d8775f648430679a709e98d2b0cb6250d2887ef',
|
|
|
|
decimals: 18,
|
|
|
|
symbol: 'BAT',
|
2019-11-18 22:46:28 +01:00
|
|
|
},
|
|
|
|
{
|
2020-11-03 00:41:28 +01:00
|
|
|
address: '0x617b3f8050a0bd94b6b1da02b4384ee5b4df13f4',
|
|
|
|
decimals: 18,
|
|
|
|
symbol: 'META',
|
2019-11-18 22:46:28 +01:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
});
|
|
|
|
done();
|
2019-11-18 22:46:28 +01:00
|
|
|
})
|
2021-02-04 19:15:23 +01:00
|
|
|
.catch(done);
|
|
|
|
});
|
2019-11-18 22:46:28 +01:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('should NOT change any state if accountTokens is not an object', function (done) {
|
2019-11-18 22:46:28 +01:00
|
|
|
const oldStorage = {
|
2020-11-03 00:41:28 +01:00
|
|
|
meta: {},
|
|
|
|
data: {
|
|
|
|
PreferencesController: {
|
|
|
|
accountTokens: [],
|
2019-11-18 22:46:28 +01:00
|
|
|
},
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2019-11-18 22:46:28 +01:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
migration39
|
|
|
|
.migrate(oldStorage)
|
2019-11-18 22:46:28 +01:00
|
|
|
.then((newStorage) => {
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.deepEqual(newStorage.data, oldStorage.data);
|
|
|
|
done();
|
2019-11-18 22:46:28 +01:00
|
|
|
})
|
2021-02-04 19:15:23 +01:00
|
|
|
.catch(done);
|
|
|
|
});
|
2019-11-18 22:46:28 +01:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('should NOT change any state if accountTokens is an object with invalid values', function (done) {
|
2019-11-18 22:46:28 +01:00
|
|
|
const oldStorage = {
|
2020-11-03 00:41:28 +01:00
|
|
|
meta: {},
|
|
|
|
data: {
|
|
|
|
PreferencesController: {
|
|
|
|
accountTokens: {
|
2019-11-18 22:46:28 +01:00
|
|
|
'0x7250739de134d33ec7ab1ee592711e15098c9d2d': [
|
|
|
|
{
|
2020-11-03 00:41:28 +01:00
|
|
|
address: '0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359',
|
|
|
|
decimals: 18,
|
|
|
|
symbol: 'DAI',
|
2019-11-18 22:46:28 +01:00
|
|
|
},
|
|
|
|
],
|
|
|
|
'0x89d24a6b4ccb1b6faa2625fe562bdd9a23260359': null,
|
|
|
|
'0x8e5d75d60224ea0c33d0041e75de68b1c3cb6dd5': {
|
2020-11-03 00:41:28 +01:00
|
|
|
mainnet: [null, undefined, [], 42],
|
|
|
|
rinkeby: null,
|
2019-11-18 22:46:28 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2019-11-18 22:46:28 +01:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
migration39
|
|
|
|
.migrate(oldStorage)
|
2019-11-18 22:46:28 +01:00
|
|
|
.then((newStorage) => {
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.deepEqual(newStorage.data, oldStorage.data);
|
|
|
|
done();
|
2019-11-18 22:46:28 +01:00
|
|
|
})
|
2021-02-04 19:15:23 +01:00
|
|
|
.catch(done);
|
|
|
|
});
|
2019-11-18 22:46:28 +01:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('should NOT change any state if accountTokens includes the new DAI token', function (done) {
|
2019-11-18 22:46:28 +01:00
|
|
|
const oldStorage = {
|
2020-11-03 00:41:28 +01:00
|
|
|
meta: {},
|
|
|
|
data: {
|
|
|
|
PreferencesController: {
|
|
|
|
accountTokens: {
|
2019-11-18 22:46:28 +01:00
|
|
|
'0x7250739de134d33ec7ab1ee592711e15098c9d2d': {
|
2020-11-03 00:41:28 +01:00
|
|
|
mainnet: [
|
2019-11-18 22:46:28 +01:00
|
|
|
{
|
2020-11-03 00:41:28 +01:00
|
|
|
address: '0x6B175474E89094C44Da98b954EedeAC495271d0F',
|
|
|
|
decimals: 18,
|
|
|
|
symbol: 'DAI',
|
2019-11-18 22:46:28 +01:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
'0x8e5d75d60224ea0c33d0041e75de68b1c3cb6dd5': {
|
2020-11-03 00:41:28 +01:00
|
|
|
mainnet: [],
|
|
|
|
rinkeby: [],
|
2019-11-18 22:46:28 +01:00
|
|
|
},
|
|
|
|
'0x8e5d75d60224ea0c33d1041e75de68b1c3cb6dd5': {},
|
|
|
|
'0xb3958fb96c8201486ae20be1d5c9f58083df343a': {
|
2020-11-03 00:41:28 +01:00
|
|
|
mainnet: [
|
2019-11-18 22:46:28 +01:00
|
|
|
{
|
2020-11-03 00:41:28 +01:00
|
|
|
address: '0x6B175474E89094C44Da98b954EedeAC495271d0F',
|
|
|
|
decimals: 18,
|
|
|
|
symbol: 'DAI',
|
2019-11-18 22:46:28 +01:00
|
|
|
},
|
|
|
|
{
|
2020-11-03 00:41:28 +01:00
|
|
|
address: '0x0d8775f648430679a709e98d2b0cb6250d2887ef',
|
|
|
|
decimals: 18,
|
|
|
|
symbol: 'BAT',
|
2019-11-18 22:46:28 +01:00
|
|
|
},
|
|
|
|
{
|
2020-11-03 00:41:28 +01:00
|
|
|
address: '0x617b3f8050a0bd94b6b1da02b4384ee5b4df13f4',
|
|
|
|
decimals: 18,
|
|
|
|
symbol: 'META',
|
2019-11-18 22:46:28 +01:00
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2019-11-18 22:46:28 +01:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
migration39
|
|
|
|
.migrate(oldStorage)
|
2019-11-18 22:46:28 +01:00
|
|
|
.then((newStorage) => {
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.deepEqual(newStorage.data, oldStorage.data);
|
|
|
|
done();
|
2019-11-18 22:46:28 +01:00
|
|
|
})
|
2021-02-04 19:15:23 +01:00
|
|
|
.catch(done);
|
|
|
|
});
|
2019-11-18 22:46:28 +01:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('should NOT change any state if tokens includes the new DAI token', function (done) {
|
2019-11-18 22:46:28 +01:00
|
|
|
const oldStorage = {
|
2020-11-03 00:41:28 +01:00
|
|
|
meta: {},
|
|
|
|
data: {
|
|
|
|
PreferencesController: {
|
|
|
|
tokens: [
|
|
|
|
{
|
|
|
|
address: '0x6B175474E89094C44Da98b954EedeAC495271d0F',
|
|
|
|
symbol: 'DAI',
|
|
|
|
decimals: 18,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
address: '0x617b3f8050a0bd94b6b1da02b4384ee5b4df13f4',
|
|
|
|
symbol: 'META',
|
|
|
|
decimals: 18,
|
|
|
|
},
|
|
|
|
],
|
2019-11-18 22:46:28 +01:00
|
|
|
},
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2019-11-18 22:46:28 +01:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
migration39
|
|
|
|
.migrate(oldStorage)
|
2019-11-18 22:46:28 +01:00
|
|
|
.then((newStorage) => {
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.deepEqual(newStorage.data, oldStorage.data);
|
|
|
|
done();
|
2019-11-18 22:46:28 +01:00
|
|
|
})
|
2021-02-04 19:15:23 +01:00
|
|
|
.catch(done);
|
|
|
|
});
|
2019-11-18 22:46:28 +01:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('should NOT change any state if tokens does not include DAI', function (done) {
|
2019-11-18 22:46:28 +01:00
|
|
|
const oldStorage = {
|
2020-11-03 00:41:28 +01:00
|
|
|
meta: {},
|
|
|
|
data: {
|
|
|
|
PreferencesController: {
|
|
|
|
tokens: [
|
|
|
|
{
|
|
|
|
address: '0x0d8775f648430679a709e98d2b0cb6250d2887ef',
|
|
|
|
symbol: 'BAT',
|
|
|
|
decimals: 18,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
address: '0x617b3f8050a0bd94b6b1da02b4384ee5b4df13f4',
|
|
|
|
symbol: 'META',
|
|
|
|
decimals: 18,
|
|
|
|
},
|
|
|
|
],
|
2019-11-18 22:46:28 +01:00
|
|
|
},
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2019-11-18 22:46:28 +01:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
migration39
|
|
|
|
.migrate(oldStorage)
|
2019-11-18 22:46:28 +01:00
|
|
|
.then((newStorage) => {
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.deepEqual(newStorage.data, oldStorage.data);
|
|
|
|
done();
|
2019-11-18 22:46:28 +01:00
|
|
|
})
|
2021-02-04 19:15:23 +01:00
|
|
|
.catch(done);
|
|
|
|
});
|
2019-11-18 22:46:28 +01:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('should NOT change any state if a tokens property has invalid entries', function (done) {
|
2019-11-18 22:46:28 +01:00
|
|
|
const oldStorage = {
|
2020-11-03 00:41:28 +01:00
|
|
|
meta: {},
|
|
|
|
data: {
|
|
|
|
PreferencesController: {
|
|
|
|
tokens: [null, [], undefined, 42],
|
2019-11-18 22:46:28 +01:00
|
|
|
},
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2019-11-18 22:46:28 +01:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
migration39
|
|
|
|
.migrate(oldStorage)
|
2019-11-18 22:46:28 +01:00
|
|
|
.then((newStorage) => {
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.deepEqual(newStorage.data, oldStorage.data);
|
|
|
|
done();
|
2019-11-18 22:46:28 +01:00
|
|
|
})
|
2021-02-04 19:15:23 +01:00
|
|
|
.catch(done);
|
|
|
|
});
|
2019-11-18 22:46:28 +01:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('should NOT change any state if a tokens property is not an array', function (done) {
|
2019-11-18 22:46:28 +01:00
|
|
|
const oldStorage = {
|
2020-11-03 00:41:28 +01:00
|
|
|
meta: {},
|
|
|
|
data: {
|
|
|
|
PreferencesController: {
|
|
|
|
tokens: {},
|
2019-11-18 22:46:28 +01:00
|
|
|
},
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2019-11-18 22:46:28 +01:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
migration39
|
|
|
|
.migrate(oldStorage)
|
2019-11-18 22:46:28 +01:00
|
|
|
.then((newStorage) => {
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.deepEqual(newStorage.data, oldStorage.data);
|
|
|
|
done();
|
2019-11-18 22:46:28 +01:00
|
|
|
})
|
2021-02-04 19:15:23 +01:00
|
|
|
.catch(done);
|
|
|
|
});
|
2019-11-18 22:46:28 +01:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('should NOT change any state if a tokens property is null', function (done) {
|
2019-11-18 22:46:28 +01:00
|
|
|
const oldStorage = {
|
2020-11-03 00:41:28 +01:00
|
|
|
meta: {},
|
|
|
|
data: {
|
|
|
|
PreferencesController: {
|
|
|
|
tokens: null,
|
2019-11-18 22:46:28 +01:00
|
|
|
},
|
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2019-11-18 22:46:28 +01:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
migration39
|
|
|
|
.migrate(oldStorage)
|
2019-11-18 22:46:28 +01:00
|
|
|
.then((newStorage) => {
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.deepEqual(newStorage.data, oldStorage.data);
|
|
|
|
done();
|
2019-11-18 22:46:28 +01:00
|
|
|
})
|
2021-02-04 19:15:23 +01:00
|
|
|
.catch(done);
|
|
|
|
});
|
2019-11-18 22:46:28 +01:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('should NOT change any state if a tokens property is missing', function (done) {
|
2019-11-18 22:46:28 +01:00
|
|
|
const oldStorage = {
|
2020-11-03 00:41:28 +01:00
|
|
|
meta: {},
|
|
|
|
data: {
|
|
|
|
PreferencesController: {},
|
2019-11-18 22:46:28 +01:00
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2019-11-18 22:46:28 +01:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
migration39
|
|
|
|
.migrate(oldStorage)
|
2019-11-18 22:46:28 +01:00
|
|
|
.then((newStorage) => {
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.deepEqual(newStorage.data, oldStorage.data);
|
|
|
|
done();
|
2019-11-18 22:46:28 +01:00
|
|
|
})
|
2021-02-04 19:15:23 +01:00
|
|
|
.catch(done);
|
|
|
|
});
|
2019-11-18 22:46:28 +01:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('should NOT change any state if a accountTokens property is missing', function (done) {
|
2019-11-18 22:46:28 +01:00
|
|
|
const oldStorage = {
|
2020-11-03 00:41:28 +01:00
|
|
|
meta: {},
|
|
|
|
data: {
|
|
|
|
PreferencesController: {},
|
2019-11-18 22:46:28 +01:00
|
|
|
},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2019-11-18 22:46:28 +01:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
migration39
|
|
|
|
.migrate(oldStorage)
|
2019-11-18 22:46:28 +01:00
|
|
|
.then((newStorage) => {
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.deepEqual(newStorage.data, oldStorage.data);
|
|
|
|
done();
|
2019-11-18 22:46:28 +01:00
|
|
|
})
|
2021-02-04 19:15:23 +01:00
|
|
|
.catch(done);
|
|
|
|
});
|
2019-11-18 22:46:28 +01:00
|
|
|
|
2020-02-11 17:51:13 +01:00
|
|
|
it('should NOT change any state if PreferencesController is missing', function (done) {
|
2019-11-18 22:46:28 +01:00
|
|
|
const oldStorage = {
|
2020-11-03 00:41:28 +01:00
|
|
|
meta: {},
|
|
|
|
data: {},
|
2021-02-04 19:15:23 +01:00
|
|
|
};
|
2019-11-18 22:46:28 +01:00
|
|
|
|
2020-11-03 00:41:28 +01:00
|
|
|
migration39
|
|
|
|
.migrate(oldStorage)
|
2019-11-18 22:46:28 +01:00
|
|
|
.then((newStorage) => {
|
2021-02-04 19:15:23 +01:00
|
|
|
assert.deepEqual(newStorage.data, oldStorage.data);
|
|
|
|
done();
|
2019-11-18 22:46:28 +01:00
|
|
|
})
|
2021-02-04 19:15:23 +01:00
|
|
|
.catch(done);
|
|
|
|
});
|
|
|
|
});
|