aboutsummaryrefslogtreecommitdiffstats
path: root/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2018-04-04 10:35:58 +0800
committerFabio Berger <me@fabioberger.com>2018-04-04 10:35:58 +0800
commit5e4e27fed5b9b7c889e6e6e1805377b9eff31a3a (patch)
treec6894bbd970482b111498827464f3930e501c212 /packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts
parent6c02722f56dd37dd4237248e73d070755f86f318 (diff)
downloaddexon-sol-tools-5e4e27fed5b9b7c889e6e6e1805377b9eff31a3a.tar.gz
dexon-sol-tools-5e4e27fed5b9b7c889e6e6e1805377b9eff31a3a.tar.zst
dexon-sol-tools-5e4e27fed5b9b7c889e6e6e1805377b9eff31a3a.zip
Update dev-utils and subproviders tests to use ganache in-process provider
Diffstat (limited to 'packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts')
-rw-r--r--packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts9
1 files changed, 9 insertions, 0 deletions
diff --git a/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts b/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts
index a347ab765..ab540e202 100644
--- a/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts
+++ b/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts
@@ -3,11 +3,13 @@ import * as chai from 'chai';
import * as _ from 'lodash';
import Web3 = require('web3');
import Web3ProviderEngine = require('web3-provider-engine');
+import RpcSubprovider = require('web3-provider-engine/subproviders/rpc');
import { RedundantRPCSubprovider } from '../../src';
import { DoneCallback } from '../../src/types';
import { chaiSetup } from '../chai_setup';
import { reportCallbackErrors } from '../utils/report_callback_errors';
+import { subprovider as ganacheSubprovider } from '../utils/subprovider';
const expect = chai.expect;
chaiSetup.configure();
@@ -18,6 +20,8 @@ describe('RedundantRpcSubprovider', () => {
provider = new Web3ProviderEngine();
const endpoints = ['http://localhost:8545'];
const redundantSubprovider = new RedundantRPCSubprovider(endpoints);
+ // Hack: Hot-swap rpc with ganacheSubprovider
+ (redundantSubprovider as any)._rpcs = [ganacheSubprovider];
provider.addProvider(redundantSubprovider);
provider.start();
@@ -38,6 +42,11 @@ describe('RedundantRpcSubprovider', () => {
provider = new Web3ProviderEngine();
const endpoints = ['http://does-not-exist:3000', 'http://localhost:8545'];
const redundantSubprovider = new RedundantRPCSubprovider(endpoints);
+ // Hack: Hot-swap rpcs with [nonExistentSubprovider, ganacheSubprovider]
+ const nonExistentSubprovider = new RpcSubprovider({
+ rpcUrl: 'http://does-not-exist:3000',
+ });
+ (redundantSubprovider as any)._rpcs = [nonExistentSubprovider, ganacheSubprovider];
provider.addProvider(redundantSubprovider);
provider.start();