aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-07-04 13:48:37 +0800
committerGitHub <noreply@github.com>2018-07-04 13:48:37 +0800
commitaeea3817a48473aec0eb378b0ad6cbe7e7877044 (patch)
tree3d67e0eea2a8d21a71a4cc1a6a58f8d86b09a8f8
parent0900e0c85e76a34301ad5a336d2b195ed595aef7 (diff)
parent4ba108d12f857ae29c5f5d46fec005027609666d (diff)
downloaddexon-sol-tools-aeea3817a48473aec0eb378b0ad6cbe7e7877044.tar
dexon-sol-tools-aeea3817a48473aec0eb378b0ad6cbe7e7877044.tar.gz
dexon-sol-tools-aeea3817a48473aec0eb378b0ad6cbe7e7877044.tar.bz2
dexon-sol-tools-aeea3817a48473aec0eb378b0ad6cbe7e7877044.tar.lz
dexon-sol-tools-aeea3817a48473aec0eb378b0ad6cbe7e7877044.tar.xz
dexon-sol-tools-aeea3817a48473aec0eb378b0ad6cbe7e7877044.tar.zst
dexon-sol-tools-aeea3817a48473aec0eb378b0ad6cbe7e7877044.zip
Merge pull request #818 from 0xProject/fix-intermittent-test-failure
Fix intermittent test failure in Subproviders package
-rw-r--r--packages/subproviders/package.json2
-rw-r--r--packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts5
2 files changed, 7 insertions, 0 deletions
diff --git a/packages/subproviders/package.json b/packages/subproviders/package.json
index a3ff31f53..8634341ae 100644
--- a/packages/subproviders/package.json
+++ b/packages/subproviders/package.json
@@ -69,6 +69,7 @@
"@types/lodash": "4.14.104",
"@types/mocha": "^2.2.42",
"@types/node": "^8.0.53",
+ "@types/sinon": "^2.2.2",
"chai": "^4.0.1",
"chai-as-promised": "^7.1.0",
"copyfiles": "^1.2.0",
@@ -78,6 +79,7 @@
"npm-run-all": "^4.1.2",
"nyc": "^11.0.1",
"shx": "^0.2.2",
+ "sinon": "^4.0.0",
"tslint": "5.8.0",
"typedoc": "0xProject/typedoc",
"typescript": "2.7.1",
diff --git a/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts b/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts
index 593027849..810fb8f45 100644
--- a/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts
+++ b/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts
@@ -1,6 +1,7 @@
import { DoneCallback } from '@0xproject/types';
import * as chai from 'chai';
import { JSONRPCResponsePayload } from 'ethereum-types';
+import * as Sinon from 'sinon';
import Web3ProviderEngine = require('web3-provider-engine');
import RpcSubprovider = require('web3-provider-engine/subproviders/rpc');
@@ -41,6 +42,9 @@ describe('RedundantSubprovider', () => {
const nonExistentSubprovider = new RpcSubprovider({
rpcUrl: 'http://does-not-exist:3000',
});
+ const handleRequestStub = Sinon.stub(nonExistentSubprovider, 'handleRequest').throws(
+ new Error('REQUEST_FAILED'),
+ );
const subproviders = [nonExistentSubprovider as Subprovider, ganacheSubprovider];
const redundantSubprovider = new RedundantSubprovider(subproviders);
provider.addProvider(redundantSubprovider);
@@ -55,6 +59,7 @@ describe('RedundantSubprovider', () => {
const callback = reportCallbackErrors(done)((err: Error, response: JSONRPCResponsePayload) => {
expect(err).to.be.a('null');
expect(response.result.length).to.be.equal(DEFAULT_NUM_ACCOUNTS);
+ handleRequestStub.restore();
done();
});
provider.sendAsync(payload, callback);