diff options
author | Fabio Berger <me@fabioberger.com> | 2018-05-23 04:02:21 +0800 |
---|---|---|
committer | Fabio Berger <me@fabioberger.com> | 2018-05-23 04:02:21 +0800 |
commit | 2b793f372abc444702406539588f2101d9dc5307 (patch) | |
tree | 5d407c63d4fc5ebaa9537bf0bca2346c684a1a82 /packages/contracts/test/exchange/wrapper.ts | |
parent | 9119ee14b6d49b2c339b786f92913ff8a93ff610 (diff) | |
parent | 4cfeb6b8ace9c1613ac0581bd6ea52ff183701f9 (diff) | |
download | dexon-sol-tools-2b793f372abc444702406539588f2101d9dc5307.tar dexon-sol-tools-2b793f372abc444702406539588f2101d9dc5307.tar.gz dexon-sol-tools-2b793f372abc444702406539588f2101d9dc5307.tar.bz2 dexon-sol-tools-2b793f372abc444702406539588f2101d9dc5307.tar.lz dexon-sol-tools-2b793f372abc444702406539588f2101d9dc5307.tar.xz dexon-sol-tools-2b793f372abc444702406539588f2101d9dc5307.tar.zst dexon-sol-tools-2b793f372abc444702406539588f2101d9dc5307.zip |
Merge branch 'v2-prototype' into refactor/contracts/remove0xjsDep
* v2-prototype:
Fix tslint issues
Add `are` to boolean naming conventions
Fix tslint
Fix the tsutils version, fixing ts typings issue
Rename some variables in multi_sig_with_time_lock.ts
Remove extra awaitTransactionMinedAsync calls
Update artifacts
Update yarn.lock
Fix warnings in Metacoin
Upgrade UglifyJS to include ES6 support
Add CancelOrder and MatchOrder types
Add missing return types
Ignore classnames linter rule
Apply changes to test/exchange/match_orders.ts
Fix some unhandled promise rejections
Add awaitTransactionMinedAsync after every sent transaction
Add missing blockchainLifecycle calls to contracts tests
# Conflicts:
# packages/contracts/src/utils/exchange_wrapper.ts
# packages/contracts/test/asset_proxy/proxies.ts
# packages/contracts/test/exchange/dispatcher.ts
# packages/contracts/test/multi_sig_with_time_lock.ts
Diffstat (limited to 'packages/contracts/test/exchange/wrapper.ts')
-rw-r--r-- | packages/contracts/test/exchange/wrapper.ts | 60 |
1 files changed, 42 insertions, 18 deletions
diff --git a/packages/contracts/test/exchange/wrapper.ts b/packages/contracts/test/exchange/wrapper.ts index 4ff530874..99f23a5db 100644 --- a/packages/contracts/test/exchange/wrapper.ts +++ b/packages/contracts/test/exchange/wrapper.ts @@ -54,6 +54,12 @@ describe('Exchange wrappers', () => { let defaultTakerAssetAddress: string; before(async () => { + await blockchainLifecycle.startAsync(); + }); + after(async () => { + await blockchainLifecycle.revertAsync(); + }); + before(async () => { const accounts = await web3Wrapper.getAvailableAddressesAsync(); const usedAddresses = ([owner, makerAddress, takerAddress, feeRecipientAddress] = accounts); @@ -81,12 +87,18 @@ describe('Exchange wrappers', () => { await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC20, erc20Proxy.address, owner); await exchangeWrapper.registerAssetProxyAsync(AssetProxyId.ERC721, erc721Proxy.address, owner); - await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { - from: owner, - }); - await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { - from: owner, - }); + await web3Wrapper.awaitTransactionMinedAsync( + await erc20Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { + from: owner, + }), + constants.AWAIT_TRANSACTION_MINED_MS, + ); + await web3Wrapper.awaitTransactionMinedAsync( + await erc721Proxy.addAuthorizedAddress.sendTransactionAsync(exchange.address, { + from: owner, + }), + constants.AWAIT_TRANSACTION_MINED_MS, + ); defaultMakerAssetAddress = erc20TokenA.address; defaultTakerAssetAddress = erc20TokenB.address; @@ -244,13 +256,19 @@ describe('Exchange wrappers', () => { it('should not change erc20Balances if maker allowances are too low to fill order', async () => { const signedOrder = orderFactory.newSignedOrder(); - await erc20TokenA.approve.sendTransactionAsync(erc20Proxy.address, new BigNumber(0), { - from: makerAddress, - }); + await web3Wrapper.awaitTransactionMinedAsync( + await erc20TokenA.approve.sendTransactionAsync(erc20Proxy.address, new BigNumber(0), { + from: makerAddress, + }), + constants.AWAIT_TRANSACTION_MINED_MS, + ); await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress); - await erc20TokenA.approve.sendTransactionAsync(erc20Proxy.address, constants.INITIAL_ERC20_ALLOWANCE, { - from: makerAddress, - }); + await web3Wrapper.awaitTransactionMinedAsync( + await erc20TokenA.approve.sendTransactionAsync(erc20Proxy.address, constants.INITIAL_ERC20_ALLOWANCE, { + from: makerAddress, + }), + constants.AWAIT_TRANSACTION_MINED_MS, + ); const newBalances = await erc20Wrapper.getBalancesAsync(); expect(newBalances).to.be.deep.equal(erc20Balances); @@ -258,13 +276,19 @@ describe('Exchange wrappers', () => { it('should not change erc20Balances if taker allowances are too low to fill order', async () => { const signedOrder = orderFactory.newSignedOrder(); - await erc20TokenB.approve.sendTransactionAsync(erc20Proxy.address, new BigNumber(0), { - from: takerAddress, - }); + await web3Wrapper.awaitTransactionMinedAsync( + await erc20TokenB.approve.sendTransactionAsync(erc20Proxy.address, new BigNumber(0), { + from: takerAddress, + }), + constants.AWAIT_TRANSACTION_MINED_MS, + ); await exchangeWrapper.fillOrderNoThrowAsync(signedOrder, takerAddress); - await erc20TokenB.approve.sendTransactionAsync(erc20Proxy.address, constants.INITIAL_ERC20_ALLOWANCE, { - from: takerAddress, - }); + await web3Wrapper.awaitTransactionMinedAsync( + await erc20TokenB.approve.sendTransactionAsync(erc20Proxy.address, constants.INITIAL_ERC20_ALLOWANCE, { + from: takerAddress, + }), + constants.AWAIT_TRANSACTION_MINED_MS, + ); const newBalances = await erc20Wrapper.getBalancesAsync(); expect(newBalances).to.be.deep.equal(erc20Balances); |