From d15002a1109ea00f4d92c7ae6259b5b657f5e4b3 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Tue, 30 May 2017 12:30:38 +0200 Subject: Add tests for setProvider --- test/utils/web3_factory.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'test/utils') 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; }, }; -- cgit v1.2.3