Add test for logs decoding in awaitTransactionMinedAsync
This commit is contained in:
		@@ -6,6 +6,7 @@ import * as BigNumber from 'bignumber.js';
 | 
				
			|||||||
import * as Sinon from 'sinon';
 | 
					import * as Sinon from 'sinon';
 | 
				
			||||||
import {ZeroEx, Order} from '../src';
 | 
					import {ZeroEx, Order} from '../src';
 | 
				
			||||||
import {constants} from './utils/constants';
 | 
					import {constants} from './utils/constants';
 | 
				
			||||||
 | 
					import {TokenUtils} from './utils/token_utils';
 | 
				
			||||||
import {web3Factory} from './utils/web3_factory';
 | 
					import {web3Factory} from './utils/web3_factory';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
chaiSetup.configure();
 | 
					chaiSetup.configure();
 | 
				
			||||||
@@ -204,4 +205,23 @@ describe('ZeroEx library', () => {
 | 
				
			|||||||
            expect(ecSignature).to.deep.equal(expectedECSignature);
 | 
					            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(),
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					    });
 | 
				
			||||||
});
 | 
					});
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user