aboutsummaryrefslogtreecommitdiffstats
path: root/test/utils/web3_factory.ts
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-08-17 06:34:09 +0800
committerFabio Berger <me@fabioberger.com>2017-08-17 06:34:09 +0800
commita32b94bac440f127c0b984d7a1e763cf4cb86792 (patch)
tree22aa4b13e067017220c579958bcc8225a5b22a84 /test/utils/web3_factory.ts
parent6ec3c8728e639b74bd94ce222097fd0841bb0399 (diff)
downloaddexon-sol-tools-a32b94bac440f127c0b984d7a1e763cf4cb86792.tar
dexon-sol-tools-a32b94bac440f127c0b984d7a1e763cf4cb86792.tar.gz
dexon-sol-tools-a32b94bac440f127c0b984d7a1e763cf4cb86792.tar.bz2
dexon-sol-tools-a32b94bac440f127c0b984d7a1e763cf4cb86792.tar.lz
dexon-sol-tools-a32b94bac440f127c0b984d7a1e763cf4cb86792.tar.xz
dexon-sol-tools-a32b94bac440f127c0b984d7a1e763cf4cb86792.tar.zst
dexon-sol-tools-a32b94bac440f127c0b984d7a1e763cf4cb86792.zip
Remove isUserAddressAvailable assertion from getBalanceAsync and add regression test
Diffstat (limited to 'test/utils/web3_factory.ts')
-rw-r--r--test/utils/web3_factory.ts10
1 files changed, 7 insertions, 3 deletions
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,
}));