diff options
author | Fabio Berger <me@fabioberger.com> | 2018-04-06 14:03:14 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-04-06 14:03:14 +0800 |
commit | 24454938e51e40ae74809f15bd1f612c69c218ec (patch) | |
tree | 706a1a738d3e0a172c62343c0dfb5bad39163d9f /packages/0x.js/test/0x.js_test.ts | |
parent | 89a72ebf0dbff606d511ae51bfee7ffc0a5df18f (diff) | |
download | dexon-sol-tools-24454938e51e40ae74809f15bd1f612c69c218ec.tar.gz dexon-sol-tools-24454938e51e40ae74809f15bd1f612c69c218ec.tar.zst dexon-sol-tools-24454938e51e40ae74809f15bd1f612c69c218ec.zip |
Move away from using web3 directly in 0x.js tests
Diffstat (limited to 'packages/0x.js/test/0x.js_test.ts')
-rw-r--r-- | packages/0x.js/test/0x.js_test.ts | 22 |
1 files changed, 6 insertions, 16 deletions
diff --git a/packages/0x.js/test/0x.js_test.ts b/packages/0x.js/test/0x.js_test.ts index 2ae944a99..e6163d568 100644 --- a/packages/0x.js/test/0x.js_test.ts +++ b/packages/0x.js/test/0x.js_test.ts @@ -12,19 +12,9 @@ import { ApprovalContractEventArgs, LogWithDecodedArgs, Order, TokenEvents, Zero import { runMigrationsAsync } from './migrations/migrate'; import { chaiSetup } from './utils/chai_setup'; import { constants } from './utils/constants'; +import { deployer } from './utils/deployer'; import { TokenUtils } from './utils/token_utils'; -import { web3, web3Wrapper } from './utils/web3_wrapper'; - -const artifactsDir = path.resolve('test', 'artifacts'); -const deployerOpts = { - artifactsDir, - web3Provider: web3.currentProvider, - networkId: constants.TESTRPC_NETWORK_ID, - defaults: { - gas: devConstants.GAS_ESTIMATE, - }, -}; -const deployer = new Deployer(deployerOpts); +import { provider, web3Wrapper } from './utils/web3_wrapper'; const blockchainLifecycle = new BlockchainLifecycle(web3Wrapper); chaiSetup.configure(); @@ -39,7 +29,7 @@ describe('ZeroEx library', () => { const config = { networkId: constants.TESTRPC_NETWORK_ID, }; - zeroEx = new ZeroEx(web3.currentProvider, config); + zeroEx = new ZeroEx(provider, config); }); describe('#setProvider', () => { it('overrides provider in nested web3s and invalidates contractInstances', async () => { @@ -49,7 +39,7 @@ describe('ZeroEx library', () => { expect((zeroEx.exchange as any)._exchangeContractIfExists).to.not.be.undefined(); expect((zeroEx.tokenRegistry as any)._tokenRegistryContractIfExists).to.not.be.undefined(); - const newProvider = web3.currentProvider; + const newProvider = provider; // Add property to newProvider so that we can differentiate it from old provider (newProvider as any).zeroExTestId = 1; zeroEx.setProvider(newProvider, constants.TESTRPC_NETWORK_ID); @@ -296,7 +286,7 @@ describe('ZeroEx library', () => { exchangeContractAddress: ZeroEx.NULL_ADDRESS, networkId: constants.TESTRPC_NETWORK_ID, }; - const zeroExWithWrongExchangeAddress = new ZeroEx(web3.currentProvider, zeroExConfig); + const zeroExWithWrongExchangeAddress = new ZeroEx(provider, zeroExConfig); expect(zeroExWithWrongExchangeAddress.exchange.getContractAddress()).to.be.equal(ZeroEx.NULL_ADDRESS); }); it('allows to specify token registry token contract address', async () => { @@ -304,7 +294,7 @@ describe('ZeroEx library', () => { tokenRegistryContractAddress: ZeroEx.NULL_ADDRESS, networkId: constants.TESTRPC_NETWORK_ID, }; - const zeroExWithWrongTokenRegistryAddress = new ZeroEx(web3.currentProvider, zeroExConfig); + const zeroExWithWrongTokenRegistryAddress = new ZeroEx(provider, zeroExConfig); expect(zeroExWithWrongTokenRegistryAddress.tokenRegistry.getContractAddress()).to.be.equal( ZeroEx.NULL_ADDRESS, ); |