A Metamask fork with Infura removed and default networks editable
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
ciphermask/app/scripts/migrations/035.test.js

77 lines
1.9 KiB

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);
});
});