diff options
author | Frankie <frankie.diamond@gmail.com> | 2017-07-26 06:26:41 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-26 06:26:41 +0800 |
commit | a929fb2387de87619192ea0a86fe1ead4f7a0361 (patch) | |
tree | 21ced267219f692dc00234f814059e7dc68afbda /test | |
parent | b81f8831505b1ebb1d58a474d52b068d42879d56 (diff) | |
parent | 0c73d6d852ac9c98613f71d6ee87f9d89c3c2b47 (diff) | |
download | tangerine-wallet-browser-a929fb2387de87619192ea0a86fe1ead4f7a0361.tar tangerine-wallet-browser-a929fb2387de87619192ea0a86fe1ead4f7a0361.tar.gz tangerine-wallet-browser-a929fb2387de87619192ea0a86fe1ead4f7a0361.tar.bz2 tangerine-wallet-browser-a929fb2387de87619192ea0a86fe1ead4f7a0361.tar.lz tangerine-wallet-browser-a929fb2387de87619192ea0a86fe1ead4f7a0361.tar.xz tangerine-wallet-browser-a929fb2387de87619192ea0a86fe1ead4f7a0361.tar.zst tangerine-wallet-browser-a929fb2387de87619192ea0a86fe1ead4f7a0361.zip |
Merge branch 'master' into betterErrorsOnTx
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/network-contoller-test.js | 36 | ||||
-rw-r--r-- | test/unit/tx-controller-test.js | 8 |
2 files changed, 27 insertions, 17 deletions
diff --git a/test/unit/network-contoller-test.js b/test/unit/network-contoller-test.js index 0c7ee9d70..87c2ee7a3 100644 --- a/test/unit/network-contoller-test.js +++ b/test/unit/network-contoller-test.js @@ -3,6 +3,9 @@ const NetworkController = require('../../app/scripts/controllers/network') describe('# Network Controller', function () { let networkController + const networkControllerProviderInit = { + getAccounts: () => {}, + } beforeEach(function () { networkController = new NetworkController({ @@ -10,26 +13,13 @@ describe('# Network Controller', function () { type: 'rinkeby', }, }) - // stub out provider - networkController._provider = new Proxy({}, { - get: (obj, name) => { - return () => {} - }, - }) - networkController.providerInit = { - getAccounts: () => {}, - } - networkController.ethQuery = new Proxy({}, { - get: (obj, name) => { - return () => {} - }, - }) + networkController.initializeProvider(networkControllerProviderInit, dummyProviderConstructor) }) describe('network', function () { describe('#provider', function () { it('provider should be updatable without reassignment', function () { - networkController.initializeProvider(networkController.providerInit) + networkController.initializeProvider(networkControllerProviderInit, dummyProviderConstructor) const provider = networkController.provider networkController._provider = {test: true} assert.ok(provider.test) @@ -75,3 +65,19 @@ describe('# Network Controller', function () { }) }) }) + +function dummyProviderConstructor() { + return { + // provider + sendAsync: noop, + // block tracker + start: noop, + stop: noop, + on: noop, + addListener: noop, + once: noop, + removeAllListeners: noop, + } +} + +function noop() {}
\ No newline at end of file diff --git a/test/unit/tx-controller-test.js b/test/unit/tx-controller-test.js index 7b86cfe14..31908569a 100644 --- a/test/unit/tx-controller-test.js +++ b/test/unit/tx-controller-test.js @@ -343,13 +343,17 @@ describe('Transaction Controller', function () { // Adding the fake tx: txController.addTx(clone(txMeta)) - txController._resubmitTx(txMeta, function (err) { - assert.ifError(err, 'should not throw an error') + txController._resubmitTx(txMeta) + .then(() => { const updatedMeta = txController.getTx(txMeta.id) assert.notEqual(updatedMeta.status, txMeta.status, 'status changed.') assert.equal(updatedMeta.status, 'failed', 'tx set to failed.') done() }) + .catch((err) => { + assert.ifError(err, 'should not throw an error') + done() + }) }) }) }) |