diff options
author | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-09-06 06:18:07 +0800 |
---|---|---|
committer | Leonid Logvinov <logvinov.leon@gmail.com> | 2017-09-06 06:18:07 +0800 |
commit | df904f80e323376ff8dd6aabca445fa9f0be9c1b (patch) | |
tree | 44a0795f22cde2f14e7b355d54ad0790172729c9 /test/0x.js_test.ts | |
parent | e6e12e946e8ac4a56194e14744f3e107ae620d1b (diff) | |
download | dexon-sol-tools-df904f80e323376ff8dd6aabca445fa9f0be9c1b.tar dexon-sol-tools-df904f80e323376ff8dd6aabca445fa9f0be9c1b.tar.gz dexon-sol-tools-df904f80e323376ff8dd6aabca445fa9f0be9c1b.tar.bz2 dexon-sol-tools-df904f80e323376ff8dd6aabca445fa9f0be9c1b.tar.lz dexon-sol-tools-df904f80e323376ff8dd6aabca445fa9f0be9c1b.tar.xz dexon-sol-tools-df904f80e323376ff8dd6aabca445fa9f0be9c1b.tar.zst dexon-sol-tools-df904f80e323376ff8dd6aabca445fa9f0be9c1b.zip |
Add test for logs decoding in awaitTransactionMinedAsync
Diffstat (limited to 'test/0x.js_test.ts')
-rw-r--r-- | test/0x.js_test.ts | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/0x.js_test.ts b/test/0x.js_test.ts index 2b4e80ea3..c545b3fbe 100644 --- a/test/0x.js_test.ts +++ b/test/0x.js_test.ts @@ -6,6 +6,7 @@ import * as BigNumber from 'bignumber.js'; import * as Sinon from 'sinon'; import {ZeroEx, Order} from '../src'; import {constants} from './utils/constants'; +import {TokenUtils} from './utils/token_utils'; import {web3Factory} from './utils/web3_factory'; chaiSetup.configure(); @@ -204,4 +205,23 @@ describe('ZeroEx library', () => { expect(ecSignature).to.deep.equal(expectedECSignature); }); }); + describe('#awaitTransactionMinedAsync', () => { + it('return transaction receipt with decoded logs', async () => { + const availableAddresses = await zeroEx.getAvailableAddressesAsync(); + const coinbase = availableAddresses[0]; + const tokens = await zeroEx.tokenRegistry.getTokensAsync(); + const tokenUtils = new TokenUtils(tokens); + const zrxTokenAddress = tokenUtils.getProtocolTokenOrThrow().address; + const proxyAddress = await zeroEx.proxy.getContractAddressAsync(); + const txHash = await zeroEx.token.setUnlimitedProxyAllowanceAsync(zrxTokenAddress, coinbase); + const txReceiptWithDecodedLogs = await zeroEx.awaitTransactionMinedAsync(txHash); + const log = txReceiptWithDecodedLogs.logs[0]; + expect(log.event).to.be.equal('Approval'); + expect(log.args).to.be.deep.equal({ + _owner: coinbase, + _spender: proxyAddress, + _value: zeroEx.token.UNLIMITED_ALLOWANCE_IN_BASE_UNITS.toString(), + }); + }); + }); }); |