From 709026bf1a49d468850b4ebed845c8598fa4fd75 Mon Sep 17 00:00:00 2001 From: Leonid Logvinov Date: Fri, 19 Jan 2018 15:34:28 +0100 Subject: Refactor contracts tests to not use injected web3 instance --- packages/contracts/test/token_registry.ts | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) (limited to 'packages/contracts/test/token_registry.ts') diff --git a/packages/contracts/test/token_registry.ts b/packages/contracts/test/token_registry.ts index bcb620e03..cc78feba3 100644 --- a/packages/contracts/test/token_registry.ts +++ b/packages/contracts/test/token_registry.ts @@ -1,10 +1,9 @@ import { ZeroEx } from '0x.js'; -import { BlockchainLifecycle } from '@0xproject/dev-utils'; +import { BlockchainLifecycle, devConstants, web3Factory } from '@0xproject/dev-utils'; import { Web3Wrapper } from '@0xproject/web3-wrapper'; import * as chai from 'chai'; import ethUtil = require('ethereumjs-util'); import * as _ from 'lodash'; -import * as Web3 from 'web3'; import { Artifacts } from '../util/artifacts'; import { constants } from '../util/constants'; @@ -16,10 +15,8 @@ import { chaiSetup } from './utils/chai_setup'; const { TokenRegistry } = new Artifacts(artifacts); chaiSetup.configure(); const expect = chai.expect; -// In order to benefit from type-safety, we re-assign the global web3 instance injected by Truffle -// with type `any` to a variable of type `Web3`. -const web3: Web3 = (global as any).web3; -const blockchainLifecycle = new BlockchainLifecycle(constants.RPC_URL); +const web3 = web3Factory.create(); +const blockchainLifecycle = new BlockchainLifecycle(devConstants.RPC_URL); describe('TokenRegistry', () => { const web3Wrapper = new Web3Wrapper(web3.currentProvider); -- cgit v1.2.3