aboutsummaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorbrunobar79 <brunobar79@gmail.com>2018-08-14 15:42:23 +0800
committerbrunobar79 <brunobar79@gmail.com>2018-08-14 15:42:23 +0800
commitb77cc3d9690304362471fbfe207bdad461c2ca3a (patch)
tree7852afa9e9ca10a8420b24652be59c25d0a45e0f /test/unit
parent61a279204a804ddf4815d0db6103c19c5640bbb9 (diff)
downloadtangerine-wallet-browser-b77cc3d9690304362471fbfe207bdad461c2ca3a.tar
tangerine-wallet-browser-b77cc3d9690304362471fbfe207bdad461c2ca3a.tar.gz
tangerine-wallet-browser-b77cc3d9690304362471fbfe207bdad461c2ca3a.tar.bz2
tangerine-wallet-browser-b77cc3d9690304362471fbfe207bdad461c2ca3a.tar.lz
tangerine-wallet-browser-b77cc3d9690304362471fbfe207bdad461c2ca3a.tar.xz
tangerine-wallet-browser-b77cc3d9690304362471fbfe207bdad461c2ca3a.tar.zst
tangerine-wallet-browser-b77cc3d9690304362471fbfe207bdad461c2ca3a.zip
fix tx tests
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/app/controllers/metamask-controller-test.js26
1 files changed, 18 insertions, 8 deletions
diff --git a/test/unit/app/controllers/metamask-controller-test.js b/test/unit/app/controllers/metamask-controller-test.js
index 9164fe246..79412260c 100644
--- a/test/unit/app/controllers/metamask-controller-test.js
+++ b/test/unit/app/controllers/metamask-controller-test.js
@@ -226,9 +226,9 @@ describe('MetaMaskController', function () {
it('should throw if it receives an unknown device name', async function () {
try {
- await metamaskController.connectHardware('Some random device name', 0)
+ await metamaskController.connectHardware('Some random device name', 0, `m/44/0'/0'`)
} catch (e) {
- assert.equal(e, 'Error: MetamaskController:connectHardware - Unknown device')
+ assert.equal(e, 'Error: MetamaskController:getKeyringForDevice - Unknown device')
}
})
@@ -242,14 +242,24 @@ describe('MetaMaskController', function () {
assert.equal(keyrings.length, 1)
})
+ it('should add the Ledger Hardware keyring', async function () {
+ sinon.spy(metamaskController.keyringController, 'addNewKeyring')
+ await metamaskController.connectHardware('ledger', 0).catch((e) => null)
+ const keyrings = await metamaskController.keyringController.getKeyringsByType(
+ 'Ledger Hardware'
+ )
+ assert.equal(metamaskController.keyringController.addNewKeyring.getCall(0).args, 'Ledger Hardware')
+ assert.equal(keyrings.length, 1)
+ })
+
})
describe('checkHardwareStatus', function () {
it('should throw if it receives an unknown device name', async function () {
try {
- await metamaskController.checkHardwareStatus('Some random device name')
+ await metamaskController.checkHardwareStatus('Some random device name', `m/44/0'/0'`)
} catch (e) {
- assert.equal(e, 'Error: MetamaskController:checkHardwareStatus - Unknown device')
+ assert.equal(e, 'Error: MetamaskController:getKeyringForDevice - Unknown device')
}
})
@@ -265,7 +275,7 @@ describe('MetaMaskController', function () {
try {
await metamaskController.forgetDevice('Some random device name')
} catch (e) {
- assert.equal(e, 'Error: MetamaskController:forgetDevice - Unknown device')
+ assert.equal(e, 'Error: MetamaskController:getKeyringForDevice - Unknown device')
}
})
@@ -282,7 +292,7 @@ describe('MetaMaskController', function () {
})
})
- describe('unlockTrezorAccount', function () {
+ describe('unlockHardwareWalletAccount', function () {
let accountToUnlock
let windowOpenStub
let addNewAccountStub
@@ -305,8 +315,8 @@ describe('MetaMaskController', function () {
sinon.spy(metamaskController.preferencesController, 'setAddresses')
sinon.spy(metamaskController.preferencesController, 'setSelectedAddress')
sinon.spy(metamaskController.preferencesController, 'setAccountLabel')
- await metamaskController.connectHardware('trezor', 0).catch((e) => null)
- await metamaskController.unlockTrezorAccount(accountToUnlock).catch((e) => null)
+ await metamaskController.connectHardware('trezor', 0, `m/44/0'/0'`)
+ await metamaskController.unlockHardwareWalletAccount('trezor', accountToUnlock, `m/44/0'/0'`)
})
afterEach(function () {