2023-03-06 14:36:01 +01:00
|
|
|
import migration80 from './080';
|
2023-02-24 16:09:00 +01:00
|
|
|
|
|
|
|
describe('migration #80', () => {
|
2023-03-06 14:36:01 +01:00
|
|
|
it('should update the version metadata', async () => {
|
2023-02-24 16:09:00 +01:00
|
|
|
const oldStorage = {
|
|
|
|
meta: {
|
2023-03-06 14:36:01 +01:00
|
|
|
version: 80,
|
2023-02-24 16:09:00 +01:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2023-03-06 14:36:01 +01:00
|
|
|
const newStorage = await migration80.migrate(oldStorage);
|
2023-02-24 16:09:00 +01:00
|
|
|
expect(newStorage.meta).toStrictEqual({
|
2023-03-06 14:36:01 +01:00
|
|
|
version: 80,
|
2023-02-24 16:09:00 +01:00
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2023-03-06 14:36:01 +01:00
|
|
|
it('should remove the "showPortfolioToolip" property', async () => {
|
2023-02-24 16:09:00 +01:00
|
|
|
const oldStorage = {
|
|
|
|
meta: {
|
2023-03-06 14:36:01 +01:00
|
|
|
version: 80,
|
2023-02-24 16:09:00 +01:00
|
|
|
},
|
2023-03-06 14:36:01 +01:00
|
|
|
data: {
|
|
|
|
metamask: {
|
|
|
|
isInitialized: true,
|
|
|
|
isUnlocked: true,
|
|
|
|
isAccountMenuOpen: false,
|
|
|
|
identities: {
|
|
|
|
'0x00000': {
|
|
|
|
address: '0x00000',
|
|
|
|
lastSelected: 1675966229118,
|
|
|
|
name: 'Account 1',
|
|
|
|
},
|
|
|
|
'0x00001': {
|
|
|
|
address: '0x00001',
|
|
|
|
name: 'Account 2',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
unapprovedTxs: {},
|
|
|
|
frequentRpcList: [],
|
|
|
|
addressBook: {},
|
|
|
|
popupGasPollTokens: [],
|
|
|
|
notificationGasPollTokens: [],
|
|
|
|
fullScreenGasPollTokens: [],
|
|
|
|
recoveryPhraseReminderHasBeenShown: false,
|
|
|
|
recoveryPhraseReminderLastShown: 1675966206345,
|
|
|
|
outdatedBrowserWarningLastShown: 1675966206345,
|
|
|
|
showTestnetMessageInDropdown: true,
|
|
|
|
showPortfolioTooltip: false,
|
|
|
|
showBetaHeader: false,
|
|
|
|
trezorModel: null,
|
|
|
|
qrHardware: {},
|
2023-02-24 16:09:00 +01:00
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2023-03-06 14:36:01 +01:00
|
|
|
const newStorage = await migration80.migrate(oldStorage);
|
|
|
|
expect(newStorage).toStrictEqual({
|
2023-02-24 16:09:00 +01:00
|
|
|
meta: {
|
2023-03-06 14:36:01 +01:00
|
|
|
version: 80,
|
|
|
|
},
|
|
|
|
data: {
|
|
|
|
metamask: {
|
|
|
|
isInitialized: true,
|
|
|
|
isUnlocked: true,
|
|
|
|
isAccountMenuOpen: false,
|
|
|
|
identities: {
|
|
|
|
'0x00000': {
|
|
|
|
address: '0x00000',
|
|
|
|
lastSelected: 1675966229118,
|
|
|
|
name: 'Account 1',
|
|
|
|
},
|
|
|
|
'0x00001': {
|
|
|
|
address: '0x00001',
|
|
|
|
name: 'Account 2',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
unapprovedTxs: {},
|
|
|
|
frequentRpcList: [],
|
|
|
|
addressBook: {},
|
|
|
|
popupGasPollTokens: [],
|
|
|
|
notificationGasPollTokens: [],
|
|
|
|
fullScreenGasPollTokens: [],
|
|
|
|
recoveryPhraseReminderHasBeenShown: false,
|
|
|
|
recoveryPhraseReminderLastShown: 1675966206345,
|
|
|
|
outdatedBrowserWarningLastShown: 1675966206345,
|
|
|
|
showTestnetMessageInDropdown: true,
|
|
|
|
showBetaHeader: false,
|
|
|
|
trezorModel: null,
|
|
|
|
qrHardware: {},
|
|
|
|
},
|
2023-02-24 16:09:00 +01:00
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
2023-03-06 14:36:01 +01:00
|
|
|
it('should make no changes if "showPortfolioToolip" never existed', async () => {
|
2023-02-24 16:09:00 +01:00
|
|
|
const oldStorage = {
|
|
|
|
meta: {
|
2023-03-06 14:36:01 +01:00
|
|
|
version: 80,
|
|
|
|
},
|
|
|
|
data: {
|
|
|
|
metamask: {
|
|
|
|
isInitialized: true,
|
|
|
|
isUnlocked: true,
|
|
|
|
isAccountMenuOpen: false,
|
|
|
|
identities: {
|
|
|
|
'0x00000': {
|
|
|
|
address: '0x00000',
|
|
|
|
lastSelected: 1675966229118,
|
|
|
|
name: 'Account 1',
|
|
|
|
},
|
|
|
|
'0x00001': {
|
|
|
|
address: '0x00001',
|
|
|
|
name: 'Account 2',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
unapprovedTxs: {},
|
|
|
|
frequentRpcList: [],
|
|
|
|
addressBook: {},
|
|
|
|
popupGasPollTokens: [],
|
|
|
|
notificationGasPollTokens: [],
|
|
|
|
fullScreenGasPollTokens: [],
|
|
|
|
recoveryPhraseReminderHasBeenShown: false,
|
|
|
|
recoveryPhraseReminderLastShown: 1675966206345,
|
|
|
|
outdatedBrowserWarningLastShown: 1675966206345,
|
|
|
|
showTestnetMessageInDropdown: true,
|
|
|
|
showBetaHeader: false,
|
|
|
|
trezorModel: null,
|
|
|
|
qrHardware: {},
|
|
|
|
},
|
2023-02-24 16:09:00 +01:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2023-03-06 14:36:01 +01:00
|
|
|
const newStorage = await migration80.migrate(oldStorage);
|
|
|
|
expect(newStorage).toStrictEqual({
|
2023-02-24 16:09:00 +01:00
|
|
|
meta: {
|
2023-03-06 14:36:01 +01:00
|
|
|
version: 80,
|
2023-02-24 16:09:00 +01:00
|
|
|
},
|
|
|
|
data: {
|
2023-03-06 14:36:01 +01:00
|
|
|
metamask: {
|
|
|
|
isInitialized: true,
|
|
|
|
isUnlocked: true,
|
|
|
|
isAccountMenuOpen: false,
|
|
|
|
identities: {
|
|
|
|
'0x00000': {
|
|
|
|
address: '0x00000',
|
|
|
|
lastSelected: 1675966229118,
|
|
|
|
name: 'Account 1',
|
|
|
|
},
|
|
|
|
'0x00001': {
|
|
|
|
address: '0x00001',
|
|
|
|
name: 'Account 2',
|
|
|
|
},
|
|
|
|
},
|
|
|
|
unapprovedTxs: {},
|
|
|
|
frequentRpcList: [],
|
|
|
|
addressBook: {},
|
|
|
|
popupGasPollTokens: [],
|
|
|
|
notificationGasPollTokens: [],
|
|
|
|
fullScreenGasPollTokens: [],
|
|
|
|
recoveryPhraseReminderHasBeenShown: false,
|
|
|
|
recoveryPhraseReminderLastShown: 1675966206345,
|
|
|
|
outdatedBrowserWarningLastShown: 1675966206345,
|
|
|
|
showTestnetMessageInDropdown: true,
|
|
|
|
showBetaHeader: false,
|
|
|
|
trezorModel: null,
|
|
|
|
qrHardware: {},
|
|
|
|
},
|
2023-02-24 16:09:00 +01:00
|
|
|
},
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|