diff options
Diffstat (limited to 'test/unit/idStore-migration-test.js')
-rw-r--r-- | test/unit/idStore-migration-test.js | 42 |
1 files changed, 14 insertions, 28 deletions
diff --git a/test/unit/idStore-migration-test.js b/test/unit/idStore-migration-test.js index 59801c868..54f38fb2f 100644 --- a/test/unit/idStore-migration-test.js +++ b/test/unit/idStore-migration-test.js @@ -21,6 +21,10 @@ const mockVault = { account: '0x5d8de92c205279c10e5669f797b853ccef4f739a', } +const badVault = { + seed: 'radar blur cabbage chef fix engine embark joy scheme fiction master release', +} + describe('IdentityStore to KeyringController migration', function() { // The stars of the show: @@ -52,7 +56,7 @@ describe('IdentityStore to KeyringController migration', function() { }, }) - idStore._createVault(password, mockVault.seed, null, (err) => { + idStore._createVault(password, mockVault.seed, (err) => { assert.ifError(err, 'createNewVault threw error') originalKeystore = idStore._idmgmt.keyStore @@ -64,6 +68,10 @@ describe('IdentityStore to KeyringController migration', function() { addAccount(acct) { newAccounts.push(ethUtil.addHexPrefix(acct)) }, del(acct) { delete newAccounts[acct] }, }, + txManager: { + getTxList: () => [], + getUnapprovedTxList: () => [] + }, }) // Stub out the browser crypto for a mock encryptor. @@ -75,37 +83,15 @@ describe('IdentityStore to KeyringController migration', function() { }) describe('entering a password', function() { - it('should identify an old wallet as an initialized keyring', function() { + it('should identify an old wallet as an initialized keyring', function(done) { keyringController.configManager.setWallet('something') - const state = keyringController.getState() - assert(state.isInitialized, 'old vault counted as initialized.') - }) - - /* - it('should use the password to migrate the old vault', function(done) { - this.timeout(5000) - console.log('calling submitPassword') - console.dir(keyringController) - keyringController.submitPassword(password, function (err, state) { - assert.ifError(err, 'submitPassword threw error') - - function log(str, dat) { console.log(str + ': ' + JSON.stringify(dat)) } - - let newAccounts = keyringController.getAccounts() - log('new accounts: ', newAccounts) - - let newAccount = ethUtil.addHexPrefix(newAccounts[0]) - assert.equal(ethUtil.addHexPrefix(newAccount), mockVault.account, 'restored the correct account') - const newSeed = keyringController.keyrings[0].mnemonic - log('keyringController keyrings', keyringController.keyrings) - assert.equal(newSeed, mockVault.seed, 'seed phrase transferred.') - - assert(configManager.getVault(), 'new type of vault is persisted') + keyringController.getState() + .then((state) => { + assert(state.isInitialized, 'old vault counted as initialized.') + assert(!state.lostAccounts, 'no lost accounts') done() }) }) - */ - }) }) |