diff options
author | Fabio Berger <me@fabioberger.com> | 2017-05-30 18:30:38 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2017-05-30 18:30:38 +0800 |
commit | d15002a1109ea00f4d92c7ae6259b5b657f5e4b3 (patch) | |
tree | 0aa82e04c56aaa84fee112318ca55ad57efd79c7 /test/utils | |
parent | 55b00ab3809973e385b6baffd9c44d6db5540b12 (diff) | |
download | dexon-sol-tools-d15002a1109ea00f4d92c7ae6259b5b657f5e4b3.tar dexon-sol-tools-d15002a1109ea00f4d92c7ae6259b5b657f5e4b3.tar.gz dexon-sol-tools-d15002a1109ea00f4d92c7ae6259b5b657f5e4b3.tar.bz2 dexon-sol-tools-d15002a1109ea00f4d92c7ae6259b5b657f5e4b3.tar.lz dexon-sol-tools-d15002a1109ea00f4d92c7ae6259b5b657f5e4b3.tar.xz dexon-sol-tools-d15002a1109ea00f4d92c7ae6259b5b657f5e4b3.tar.zst dexon-sol-tools-d15002a1109ea00f4d92c7ae6259b5b657f5e4b3.zip |
Add tests for setProvider
Diffstat (limited to 'test/utils')
-rw-r--r-- | test/utils/web3_factory.ts | 10 |
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; }, }; |