mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-29 07:16:36 +01:00
e78e82205a
* Jestify migrations/ * Lint exclude migrations from mocha config, and add inclusion to jest config * Add migration tests to jest config * Exclude/ignore migration tests * Set process.env.IN_TEST to true when running tests locally
77 lines
1.9 KiB
JavaScript
77 lines
1.9 KiB
JavaScript
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);
|
|
});
|
|
});
|