From 43e07e7ce3dd61af8048c20aa2355010f0c72c22 Mon Sep 17 00:00:00 2001 From: Fabio Berger Date: Wed, 4 Apr 2018 16:31:57 +0900 Subject: Update 0x.js to run tests against in-process ganache --- packages/0x.js/test/utils/constants.ts | 1 + packages/0x.js/test/utils/fill_scenarios.ts | 1 + packages/0x.js/test/utils/web3_wrapper.ts | 10 +++++++--- 3 files changed, 9 insertions(+), 3 deletions(-) (limited to 'packages/0x.js/test/utils') diff --git a/packages/0x.js/test/utils/constants.ts b/packages/0x.js/test/utils/constants.ts index cf030259c..3b74fa863 100644 --- a/packages/0x.js/test/utils/constants.ts +++ b/packages/0x.js/test/utils/constants.ts @@ -6,4 +6,5 @@ export const constants = { KOVAN_RPC_URL: 'https://kovan.infura.io/', ROPSTEN_RPC_URL: 'https://ropsten.infura.io/', ZRX_DECIMALS: 18, + NULL_BYTES: '0x', }; diff --git a/packages/0x.js/test/utils/fill_scenarios.ts b/packages/0x.js/test/utils/fill_scenarios.ts index 8b1308298..25e2aa36f 100644 --- a/packages/0x.js/test/utils/fill_scenarios.ts +++ b/packages/0x.js/test/utils/fill_scenarios.ts @@ -33,6 +33,7 @@ export class FillScenarios { } public async initTokenBalancesAsync() { const web3Wrapper = (this._zeroEx as any)._web3Wrapper as Web3Wrapper; + const networkId = await web3Wrapper.getNetworkIdAsync(); for (const token of this._tokens) { if (token.symbol !== 'ZRX' && token.symbol !== 'WETH') { const defaults = {}; diff --git a/packages/0x.js/test/utils/web3_wrapper.ts b/packages/0x.js/test/utils/web3_wrapper.ts index 4b374fc7e..35898f553 100644 --- a/packages/0x.js/test/utils/web3_wrapper.ts +++ b/packages/0x.js/test/utils/web3_wrapper.ts @@ -1,6 +1,10 @@ -import { web3Factory } from '@0xproject/dev-utils'; +import { devConstants, web3Factory } from '@0xproject/dev-utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as Web3 from 'web3'; -export const web3 = web3Factory.create(); -export const web3Wrapper = new Web3Wrapper(web3.currentProvider); +import { constants } from './constants'; + +const web3 = web3Factory.create({ shouldUseInProcessGanache: true }); +const web3Wrapper = new Web3Wrapper(web3.currentProvider); + +export { web3, web3Wrapper }; -- cgit