aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-07-05 01:19:03 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-07-05 01:26:43 +0800
commit5611df82f9f276fb161fa268f7ab468a6c1d7784 (patch)
treef65656f97027193acb941a13e42bf14735aeda43 /test
parentf39a2134b946ab2c7f24b9fcc49f95156e7682d5 (diff)
downloaddexon-0x-contracts-5611df82f9f276fb161fa268f7ab468a6c1d7784.tar
dexon-0x-contracts-5611df82f9f276fb161fa268f7ab468a6c1d7784.tar.gz
dexon-0x-contracts-5611df82f9f276fb161fa268f7ab468a6c1d7784.tar.bz2
dexon-0x-contracts-5611df82f9f276fb161fa268f7ab468a6c1d7784.tar.lz
dexon-0x-contracts-5611df82f9f276fb161fa268f7ab468a6c1d7784.tar.xz
dexon-0x-contracts-5611df82f9f276fb161fa268f7ab468a6c1d7784.tar.zst
dexon-0x-contracts-5611df82f9f276fb161fa268f7ab468a6c1d7784.zip
Refactor event tests
Diffstat (limited to 'test')
-rw-r--r--test/token_wrapper_test.ts25
1 files changed, 12 insertions, 13 deletions
diff --git a/test/token_wrapper_test.ts b/test/token_wrapper_test.ts
index c5a08dc43..6ac1beb43 100644
--- a/test/token_wrapper_test.ts
+++ b/test/token_wrapper_test.ts
@@ -13,6 +13,7 @@ import {
TokenEvents,
ContractEvent,
TransferContractEventArgs,
+ ApprovalContractEventArgs,
} from '../src';
import {BlockchainLifecycle} from './utils/blockchain_lifecycle';
import {DoneCallback} from '../src/types';
@@ -269,11 +270,10 @@ describe('TokenWrapper', () => {
zeroExEvent.watch((err: Error, event: ContractEvent) => {
expect(err).to.be.null();
expect(event).to.not.be.undefined();
- expect(event.args as TransferContractEventArgs).to.be.deep.equal({
- _from: coinbase,
- _to: addressWithoutFunds,
- _value: transferAmount,
- });
+ const args = event.args as TransferContractEventArgs;
+ expect(args._from).to.be.equal(coinbase);
+ expect(args._to).to.be.equal(addressWithoutFunds);
+ expect(args._value).to.be.equal(transferAmount);
done();
});
await zeroEx.token.transferAsync(tokenAddress, coinbase, addressWithoutFunds, transferAmount);
@@ -284,14 +284,13 @@ describe('TokenWrapper', () => {
const zeroExEvent = await zeroEx.token.subscribeAsync(
tokenAddress, TokenEvents.Approval, subscriptionOpts, indexFilterValues);
zeroExEvent.watch((err: Error, event: ContractEvent) => {
- expect(err).to.be.null();
- expect(event).to.not.be.undefined();
- expect(event.args as TransferContractEventArgs).to.be.deep.equal({
- _owner: coinbase,
- _spender: addressWithoutFunds,
- _value: allowanceAmount,
- });
- done();
+ expect(err).to.be.null();
+ expect(event).to.not.be.undefined();
+ const args = event.args as ApprovalContractEventArgs;
+ expect(args._owner).to.be.equal(coinbase);
+ expect(args._spender).to.be.equal(addressWithoutFunds);
+ expect(args._value).to.be.equal(allowanceAmount);
+ done();
});
await zeroEx.token.setAllowanceAsync(tokenAddress, coinbase, addressWithoutFunds, allowanceAmount);
})().catch(done);