diff options
Diffstat (limited to 'packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts')
-rw-r--r-- | packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts b/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts index defb741dd..c3170745c 100644 --- a/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts +++ b/packages/subproviders/test/unit/redundant_rpc_subprovider_test.ts @@ -12,45 +12,45 @@ const expect = chai.expect; chaiSetup.configure(); describe('RedundantRpcSubprovider', () => { - 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); - provider.addProvider(redundantSubprovider); - provider.start(); + 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); + provider.addProvider(redundantSubprovider); + provider.start(); - const payload = { - jsonrpc: '2.0', - method: 'eth_accounts', - params: [], - id: 1, - }; - const callback = reportCallbackErrors(done)((err: Error, response: Web3.JSONRPCResponsePayload) => { - expect(err).to.be.a('null'); - expect(response.result.length).to.be.equal(10); - done(); - }); - provider.sendAsync(payload, callback); - }); - 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); - provider.addProvider(redundantSubprovider); - provider.start(); + const payload = { + jsonrpc: '2.0', + method: 'eth_accounts', + params: [], + id: 1, + }; + const callback = reportCallbackErrors(done)((err: Error, response: Web3.JSONRPCResponsePayload) => { + expect(err).to.be.a('null'); + expect(response.result.length).to.be.equal(10); + done(); + }); + provider.sendAsync(payload, callback); + }); + 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); + provider.addProvider(redundantSubprovider); + provider.start(); - const payload = { - jsonrpc: '2.0', - method: 'eth_accounts', - params: [], - id: 1, - }; - const callback = reportCallbackErrors(done)((err: Error, response: Web3.JSONRPCResponsePayload) => { - expect(err).to.be.a('null'); - expect(response.result.length).to.be.equal(10); - done(); - }); - provider.sendAsync(payload, callback); - }); + const payload = { + jsonrpc: '2.0', + method: 'eth_accounts', + params: [], + id: 1, + }; + const callback = reportCallbackErrors(done)((err: Error, response: Web3.JSONRPCResponsePayload) => { + expect(err).to.be.a('null'); + expect(response.result.length).to.be.equal(10); + done(); + }); + provider.sendAsync(payload, callback); + }); }); |