Merge branch 'v2-prototype' into eth-lightwallet-subprovider-final
This commit is contained in:
@@ -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);
|
||||
|
Reference in New Issue
Block a user