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.
100 lines
2.2 KiB
100 lines
2.2 KiB
4 years ago
|
import assert from 'assert';
|
||
4 years ago
|
import migration35 from './035';
|
||
5 years ago
|
|
||
5 years ago
|
describe('migration #35', function () {
|
||
|
it('should update the version metadata', function (done) {
|
||
5 years ago
|
const oldStorage = {
|
||
|
meta: {
|
||
|
version: 34,
|
||
|
},
|
||
|
data: {},
|
||
4 years ago
|
};
|
||
5 years ago
|
|
||
4 years ago
|
migration35
|
||
|
.migrate(oldStorage)
|
||
5 years ago
|
.then((newStorage) => {
|
||
|
assert.deepEqual(newStorage.meta, {
|
||
4 years ago
|
version: 35,
|
||
4 years ago
|
});
|
||
|
done();
|
||
5 years ago
|
})
|
||
4 years ago
|
.catch(done);
|
||
|
});
|
||
5 years ago
|
|
||
5 years ago
|
it('should delete seedWords', function (done) {
|
||
5 years ago
|
const oldStorage = {
|
||
|
meta: {},
|
||
|
data: {
|
||
|
PreferencesController: {
|
||
|
seedWords: 'seed words',
|
||
|
},
|
||
|
},
|
||
4 years ago
|
};
|
||
5 years ago
|
|
||
4 years ago
|
migration35
|
||
|
.migrate(oldStorage)
|
||
5 years ago
|
.then((newStorage) => {
|
||
4 years ago
|
assert.deepEqual(newStorage.data.PreferencesController, {});
|
||
|
done();
|
||
5 years ago
|
})
|
||
4 years ago
|
.catch(done);
|
||
|
});
|
||
5 years ago
|
|
||
5 years ago
|
it('should delete falsy seedWords', function (done) {
|
||
5 years ago
|
const oldStorage = {
|
||
|
meta: {},
|
||
|
data: {
|
||
|
PreferencesController: {
|
||
|
seedWords: '',
|
||
|
},
|
||
|
},
|
||
4 years ago
|
};
|
||
5 years ago
|
|
||
4 years ago
|
migration35
|
||
|
.migrate(oldStorage)
|
||
5 years ago
|
.then((newStorage) => {
|
||
4 years ago
|
assert.deepEqual(newStorage.data.PreferencesController, {});
|
||
|
done();
|
||
5 years ago
|
})
|
||
4 years ago
|
.catch(done);
|
||
|
});
|
||
5 years ago
|
|
||
5 years ago
|
it('should leave state without seedWords unchanged', function (done) {
|
||
5 years ago
|
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,
|
||
|
},
|
||
|
},
|
||
4 years ago
|
};
|
||
5 years ago
|
|
||
4 years ago
|
migration35
|
||
|
.migrate(oldStorage)
|
||
5 years ago
|
.then((newStorage) => {
|
||
4 years ago
|
assert.deepEqual(newStorage.data, oldStorage.data);
|
||
|
done();
|
||
5 years ago
|
})
|
||
4 years ago
|
.catch(done);
|
||
|
});
|
||
|
});
|