aboutsummaryrefslogtreecommitdiffstats
path: root/test/utils
diff options
context:
space:
mode:
authorFabio Berger <me@fabioberger.com>2017-05-30 18:30:38 +0800
committerFabio Berger <me@fabioberger.com>2017-05-30 18:30:38 +0800
commitd15002a1109ea00f4d92c7ae6259b5b657f5e4b3 (patch)
tree0aa82e04c56aaa84fee112318ca55ad57efd79c7 /test/utils
parent55b00ab3809973e385b6baffd9c44d6db5540b12 (diff)
downloaddexon-0x-contracts-d15002a1109ea00f4d92c7ae6259b5b657f5e4b3.tar.gz
dexon-0x-contracts-d15002a1109ea00f4d92c7ae6259b5b657f5e4b3.tar.zst
dexon-0x-contracts-d15002a1109ea00f4d92c7ae6259b5b657f5e4b3.zip
Add tests for setProvider
Diffstat (limited to 'test/utils')
-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 493fbc2df..ffdc0e4cf 100644
--- a/test/utils/web3_factory.ts
+++ b/test/utils/web3_factory.ts
@@ -10,14 +10,18 @@ import {constants} from './constants';
export const web3Factory = {
create(): Web3 {
+ const provider = this.getRpcProvider();
+ const web3 = new Web3();
+ web3.setProvider(provider);
+ return web3;
+ },
+ getRpcProvider(): Web3.Provider {
const provider = new ProviderEngine();
const rpcUrl = `http://${constants.RPC_HOST}:${constants.RPC_PORT}`;
provider.addProvider(new RpcSubprovider({
rpcUrl,
}));
provider.start();
- const web3 = new Web3();
- web3.setProvider(provider);
- return web3;
+ return provider;
},
};