From a32b94bac440f127c0b984d7a1e763cf4cb86792 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 16 Aug 2017 15:34:09 -0700 Subject: Remove isUserAddressAvailable assertion from getBalanceAsync and add regression test --- test/utils/web3_factory.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'test/utils/web3_factory.ts') diff --git a/test/utils/web3_factory.ts b/test/utils/web3_factory.ts index ffdc0e4cf..f89c907f6 100644 --- a/test/utils/web3_factory.ts +++ b/test/utils/web3_factory.ts @@ -7,17 +7,21 @@ import ProviderEngine = require('web3-provider-engine'); import RpcSubprovider = require('web3-provider-engine/subproviders/rpc'); import * as Web3 from 'web3'; import {constants} from './constants'; +import {EmptyWalletSubProvider} from '../../src/subproviders/empty_wallet_subprovider'; export const web3Factory = { - create(): Web3 { - const provider = this.getRpcProvider(); + create(hasAddresses: boolean = true): Web3 { + const provider = this.getRpcProvider(hasAddresses); const web3 = new Web3(); web3.setProvider(provider); return web3; }, - getRpcProvider(): Web3.Provider { + getRpcProvider(hasAddresses: boolean): Web3.Provider { const provider = new ProviderEngine(); const rpcUrl = `http://${constants.RPC_HOST}:${constants.RPC_PORT}`; + if (!hasAddresses) { + provider.addProvider(new EmptyWalletSubProvider()); + } provider.addProvider(new RpcSubprovider({ rpcUrl, })); -- cgit v1.2.3 From b5bfcc772acc2d7c538f3809e7ab1890b9f7b1a7 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 16 Aug 2017 21:06:41 -0700 Subject: set default value to hasAddresses boolean --- test/utils/web3_factory.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test/utils/web3_factory.ts') diff --git a/test/utils/web3_factory.ts b/test/utils/web3_factory.ts index f89c907f6..b20070c74 100644 --- a/test/utils/web3_factory.ts +++ b/test/utils/web3_factory.ts @@ -16,7 +16,7 @@ export const web3Factory = { web3.setProvider(provider); return web3; }, - getRpcProvider(hasAddresses: boolean): Web3.Provider { + getRpcProvider(hasAddresses: boolean = true): Web3.Provider { const provider = new ProviderEngine(); const rpcUrl = `http://${constants.RPC_HOST}:${constants.RPC_PORT}`; if (!hasAddresses) { -- cgit v1.2.3