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.
50 lines
1.3 KiB
50 lines
1.3 KiB
4 years ago
|
import assert from 'assert';
|
||
4 years ago
|
import firstTimeState from '../first-time-state';
|
||
|
import migration26 from './026';
|
||
5 years ago
|
|
||
7 years ago
|
const oldStorage = {
|
||
4 years ago
|
meta: { version: 25 },
|
||
|
data: {
|
||
|
PreferencesController: {},
|
||
|
KeyringController: {
|
||
|
walletNicknames: {
|
||
7 years ago
|
'0x1e77e2': 'Test Account 1',
|
||
|
'0x7e57e2': 'Test Account 2',
|
||
|
},
|
||
|
},
|
||
|
},
|
||
4 years ago
|
};
|
||
7 years ago
|
|
||
5 years ago
|
describe('migration #26', function () {
|
||
|
it('should move the identities from KeyringController', function (done) {
|
||
4 years ago
|
migration26
|
||
|
.migrate(oldStorage)
|
||
7 years ago
|
.then((newStorage) => {
|
||
4 years ago
|
const { identities } = newStorage.data.PreferencesController;
|
||
7 years ago
|
assert.deepEqual(identities, {
|
||
5 years ago
|
'0x1e77e2': { name: 'Test Account 1', address: '0x1e77e2' },
|
||
|
'0x7e57e2': { name: 'Test Account 2', address: '0x7e57e2' },
|
||
4 years ago
|
});
|
||
4 years ago
|
assert.strictEqual(
|
||
|
newStorage.data.KeyringController.walletNicknames,
|
||
|
undefined,
|
||
4 years ago
|
);
|
||
|
done();
|
||
7 years ago
|
})
|
||
4 years ago
|
.catch(done);
|
||
|
});
|
||
7 years ago
|
|
||
5 years ago
|
it('should successfully migrate first time state', function (done) {
|
||
4 years ago
|
migration26
|
||
|
.migrate({
|
||
|
meta: {},
|
||
|
data: firstTimeState,
|
||
|
})
|
||
7 years ago
|
.then((migratedData) => {
|
||
4 years ago
|
assert.equal(migratedData.meta.version, migration26.version);
|
||
|
done();
|
||
4 years ago
|
})
|
||
4 years ago
|
.catch(done);
|
||
|
});
|
||
|
});
|