aboutsummaryrefslogtreecommitdiffstats
path: root/packages/subproviders/test/unit
diff options
context:
space:
mode:
Diffstat (limited to 'packages/subproviders/test/unit')
-rw-r--r--packages/subproviders/test/unit/ledger_subprovider_test.ts7
-rw-r--r--packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts18
2 files changed, 14 insertions, 11 deletions
diff --git a/packages/subproviders/test/unit/ledger_subprovider_test.ts b/packages/subproviders/test/unit/ledger_subprovider_test.ts
index c18506681..88d38f59b 100644
--- a/packages/subproviders/test/unit/ledger_subprovider_test.ts
+++ b/packages/subproviders/test/unit/ledger_subprovider_test.ts
@@ -4,7 +4,6 @@ import * as ethUtils from 'ethereumjs-util';
import * as _ from 'lodash';
import Web3 = require('web3');
import Web3ProviderEngine = require('web3-provider-engine');
-import RpcSubprovider = require('web3-provider-engine/subproviders/rpc');
import { LedgerSubprovider } from '../../src';
import {
@@ -15,6 +14,7 @@ import {
} from '../../src/types';
import { chaiSetup } from '../chai_setup';
import { fixtureData } from '../utils/fixture_data';
+import { ganacheSubprovider } from '../utils/ganache_subprovider';
import { reportCallbackErrors } from '../utils/report_callback_errors';
chaiSetup.configure();
@@ -105,10 +105,7 @@ describe('LedgerSubprovider', () => {
before(() => {
provider = new Web3ProviderEngine();
provider.addProvider(ledgerSubprovider);
- const httpProvider = new RpcSubprovider({
- rpcUrl: 'http://localhost:8545',
- });
- provider.addProvider(httpProvider);
+ provider.addProvider(ganacheSubprovider);
provider.start();
});
describe('success cases', () => {
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();