aboutsummaryrefslogtreecommitdiffstats
path: root/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts')
-rw-r--r--packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts18
1 files changed, 12 insertions, 6 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..e25cb7eb7 100644
--- a/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts
+++ b/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts
@@ -3,21 +3,24 @@ 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 { RedundantSubprovider } from '../../src';
+import { Subprovider } from '../../src/subproviders/subprovider';
import { DoneCallback } from '../../src/types';
import { chaiSetup } from '../chai_setup';
+import { ganacheSubprovider } from '../utils/ganache_subprovider';
import { reportCallbackErrors } from '../utils/report_callback_errors';
const expect = chai.expect;
chaiSetup.configure();
-describe('RedundantRpcSubprovider', () => {
+describe('RedundantSubprovider', () => {
let provider: Web3ProviderEngine;
it('succeeds when supplied a healthy endpoint', (done: DoneCallback) => {
provider = new Web3ProviderEngine();
- const endpoints = ['http://localhost:8545'];
- const redundantSubprovider = new RedundantRPCSubprovider(endpoints);
+ const subproviders = [ganacheSubprovider];
+ const redundantSubprovider = new RedundantSubprovider(subproviders);
provider.addProvider(redundantSubprovider);
provider.start();
@@ -36,8 +39,11 @@ describe('RedundantRpcSubprovider', () => {
});
it('succeeds when supplied at least one healthy endpoint', (done: DoneCallback) => {
provider = new Web3ProviderEngine();
- const endpoints = ['http://does-not-exist:3000', 'http://localhost:8545'];
- const redundantSubprovider = new RedundantRPCSubprovider(endpoints);
+ const nonExistentSubprovider = new RpcSubprovider({
+ rpcUrl: 'http://does-not-exist:3000',
+ });
+ const subproviders = [nonExistentSubprovider as Subprovider, ganacheSubprovider];
+ const redundantSubprovider = new RedundantSubprovider(subproviders);
provider.addProvider(redundantSubprovider);
provider.start();