1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-25 11:28:51 +01:00
metamask-extension/app/scripts/migrations/035.test.js

77 lines
1.9 KiB
JavaScript
Raw Normal View History

import migration35 from './035';
describe('migration #35', () => {
it('should update the version metadata', async () => {
const oldStorage = {
meta: {
version: 34,
},
data: {},
};
const newStorage = await migration35.migrate(oldStorage);
expect(newStorage.meta.version).toStrictEqual(35);
});
it('should delete seedWords', async () => {
const oldStorage = {
meta: {},
data: {
PreferencesController: {
seedWords: 'seed words',
},
},
};
const newStorage = await migration35.migrate(oldStorage);
expect(newStorage.data.PreferencesController).toStrictEqual({});
});
it('should delete falsy seedWords', async () => {
const oldStorage = {
meta: {},
data: {
PreferencesController: {
seedWords: '',
},
},
};
const newStorage = await migration35.migrate(oldStorage);
expect(newStorage.data.PreferencesController).toStrictEqual({});
});
it('should leave state without seedWords unchanged', async () => {
const oldStorage = {
meta: {},
data: {
PreferencesController: {
frequentRpcListDetail: [],
accountTokens: {},
assetImages: {},
tokens: [],
suggestedTokens: {},
useBlockie: false,
knownMethodData: {},
participateInMetaMetrics: null,
firstTimeFlowType: null,
currentLocale: 'en',
identities: {},
lostIdentities: {},
forgottenPassword: false,
preferences: {
useNativeCurrencyAsPrimaryCurrency: true,
},
completedOnboarding: false,
migratedPrivacyMode: false,
metaMetricsId: null,
metaMetricsSendCount: 0,
},
},
};
const newStorage = await migration35.migrate(oldStorage);
expect(newStorage.data).toStrictEqual(oldStorage.data);
});
});