1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-11-26 20:39:08 +01:00
metamask-extension/app/scripts/migrations/026.test.js
Mark Stacey f47cfbbb3e
Use strict assertion mode everywhere (#11012)
The `assert` module has two modes: "Legacy" and "strict". When using
strict mode, the "strict" version of each assertion method is implied.
Whereas in legacy mode, by default it will use the deprecated, "loose"
version of each assertion.

We now use strict mode everywhere. A few tests required updates where
they were asserting the wrong thing, and it was passing beforehand due
to the loose matching.
2021-05-07 17:08:24 -02:30

50 lines
1.3 KiB
JavaScript

import { strict as assert } from 'assert';
import firstTimeState from '../first-time-state';
import migration26 from './026';
const oldStorage = {
meta: { version: 25 },
data: {
PreferencesController: {},
KeyringController: {
walletNicknames: {
'0x1e77e2': 'Test Account 1',
'0x7e57e2': 'Test Account 2',
},
},
},
};
describe('migration #26', function () {
it('should move the identities from KeyringController', function (done) {
migration26
.migrate(oldStorage)
.then((newStorage) => {
const { identities } = newStorage.data.PreferencesController;
assert.deepEqual(identities, {
'0x1e77e2': { name: 'Test Account 1', address: '0x1e77e2' },
'0x7e57e2': { name: 'Test Account 2', address: '0x7e57e2' },
});
assert.strictEqual(
newStorage.data.KeyringController.walletNicknames,
undefined,
);
done();
})
.catch(done);
});
it('should successfully migrate first time state', function (done) {
migration26
.migrate({
meta: {},
data: firstTimeState,
})
.then((migratedData) => {
assert.equal(migratedData.meta.version, migration26.version);
done();
})
.catch(done);
});
});