aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrunobar79 <brunobar79@gmail.com>2018-08-15 09:19:01 +0800
committerbrunobar79 <brunobar79@gmail.com>2018-08-15 09:19:01 +0800
commitfdf202efb066008f6625ba15cec8bcaef1edfec6 (patch)
treeb8d10fdba32bc24426c7a7e5ae07ac5238c90277
parent53dcad5a3b89ca4f3a67c3f6b4d6b8f73ebd02e5 (diff)
downloadtangerine-wallet-browser-fdf202efb066008f6625ba15cec8bcaef1edfec6.tar
tangerine-wallet-browser-fdf202efb066008f6625ba15cec8bcaef1edfec6.tar.gz
tangerine-wallet-browser-fdf202efb066008f6625ba15cec8bcaef1edfec6.tar.bz2
tangerine-wallet-browser-fdf202efb066008f6625ba15cec8bcaef1edfec6.tar.lz
tangerine-wallet-browser-fdf202efb066008f6625ba15cec8bcaef1edfec6.tar.xz
tangerine-wallet-browser-fdf202efb066008f6625ba15cec8bcaef1edfec6.tar.zst
tangerine-wallet-browser-fdf202efb066008f6625ba15cec8bcaef1edfec6.zip
fixed unit tests
-rw-r--r--app/scripts/metamask-controller.js6
-rw-r--r--test/unit/app/controllers/metamask-controller-test.js14
2 files changed, 15 insertions, 5 deletions
diff --git a/app/scripts/metamask-controller.js b/app/scripts/metamask-controller.js
index c813c58ac..ac188c4df 100644
--- a/app/scripts/metamask-controller.js
+++ b/app/scripts/metamask-controller.js
@@ -551,15 +551,21 @@ module.exports = class MetamaskController extends EventEmitter {
default:
throw new Error('MetamaskController:getKeyringForDevice - Unknown device')
}
+ console.log('getting keyring for device ', deviceName, hdPath)
let keyring = await this.keyringController.getKeyringsByType(keyringName)[0]
+ console.log('got Keyring', keyring)
if (!keyring) {
+ console.log('we did not so lets add it', keyringName)
keyring = await this.keyringController.addNewKeyring(keyringName)
+ console.log('what about now', keyring)
}
+ console.log('setting hdPath', hdPath)
if (hdPath && keyring.setHdPath) {
keyring.setHdPath(hdPath)
}
keyring.network = this.networkController.getProviderConfig().type
+ console.log('setting network', keyring.network)
return keyring
diff --git a/test/unit/app/controllers/metamask-controller-test.js b/test/unit/app/controllers/metamask-controller-test.js
index 79412260c..9f25cf376 100644
--- a/test/unit/app/controllers/metamask-controller-test.js
+++ b/test/unit/app/controllers/metamask-controller-test.js
@@ -315,16 +315,20 @@ describe('MetaMaskController', function () {
sinon.spy(metamaskController.preferencesController, 'setAddresses')
sinon.spy(metamaskController.preferencesController, 'setSelectedAddress')
sinon.spy(metamaskController.preferencesController, 'setAccountLabel')
- await metamaskController.connectHardware('trezor', 0, `m/44/0'/0'`)
- await metamaskController.unlockHardwareWalletAccount('trezor', accountToUnlock, `m/44/0'/0'`)
+ await metamaskController.connectHardware('trezor', 0, `m/44/0'/0'`).catch((e) => null)
+ await metamaskController.unlockHardwareWalletAccount(accountToUnlock, 'trezor', `m/44/0'/0'`)
})
afterEach(function () {
- metamaskController.keyringController.addNewAccount.restore()
window.open.restore()
+ metamaskController.keyringController.addNewAccount.restore()
+ metamaskController.keyringController.getAccounts.restore()
+ metamaskController.preferencesController.setAddresses.restore()
+ metamaskController.preferencesController.setSelectedAddress.restore()
+ metamaskController.preferencesController.setAccountLabel.restore()
})
- it('should set accountToUnlock in the keyring', async function () {
+ it('should set unlockedAccount in the keyring', async function () {
const keyrings = await metamaskController.keyringController.getKeyringsByType(
'Trezor Hardware'
)
@@ -332,7 +336,7 @@ describe('MetaMaskController', function () {
})
- it('should call keyringController.addNewAccount', async function () {
+ it('should call keyringController.addNewAccount', async function () {
assert(metamaskController.keyringController.addNewAccount.calledOnce)
})