Add LogCancel test to subscribeAsync
This commit is contained in:
@@ -626,18 +626,34 @@ describe('ExchangeWrapper', () => {
|
|||||||
fromBlock: 0,
|
fromBlock: 0,
|
||||||
toBlock: 'latest',
|
toBlock: 'latest',
|
||||||
};
|
};
|
||||||
|
const fillTakerAmountInBaseUnits = new BigNumber(1);
|
||||||
await zeroEx.exchange.subscribeAsync(ExchangeEvents.LogFill, subscriptionOpts,
|
await zeroEx.exchange.subscribeAsync(ExchangeEvents.LogFill, subscriptionOpts,
|
||||||
indexFilterValues, (err: Error, event: ContractEvent) => {
|
indexFilterValues, (err: Error, event: ContractEvent) => {
|
||||||
expect(err).to.be.null();
|
expect(err).to.be.null();
|
||||||
expect(event).to.not.be.undefined();
|
expect(event.args.filledValueT).to.be.bignumber.equal(fillTakerAmountInBaseUnits);
|
||||||
done();
|
done();
|
||||||
});
|
});
|
||||||
const fillTakerAmountInBaseUnits = new BigNumber(1);
|
|
||||||
await zeroEx.exchange.fillOrderAsync(
|
await zeroEx.exchange.fillOrderAsync(
|
||||||
signedOrder, fillTakerAmountInBaseUnits, shouldCheckTransfer, takerAddress,
|
signedOrder, fillTakerAmountInBaseUnits, shouldCheckTransfer, takerAddress,
|
||||||
);
|
);
|
||||||
})();
|
})();
|
||||||
});
|
});
|
||||||
|
it.only('Should receive the LogCancel event when an order is cancelled', (done: DoneCallback) => {
|
||||||
|
(async () => {
|
||||||
|
const subscriptionOpts: SubscriptionOpts = {
|
||||||
|
fromBlock: 0,
|
||||||
|
toBlock: 'latest',
|
||||||
|
};
|
||||||
|
const cancelTakerAmountInBaseUnits = new BigNumber(1);
|
||||||
|
await zeroEx.exchange.subscribeAsync(ExchangeEvents.LogCancel, subscriptionOpts,
|
||||||
|
indexFilterValues, (err: Error, event: ContractEvent) => {
|
||||||
|
expect(err).to.be.null();
|
||||||
|
expect(event.args.cancelledValueT).to.be.bignumber.equal(cancelTakerAmountInBaseUnits);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
await zeroEx.exchange.cancelOrderAsync(signedOrder, cancelTakerAmountInBaseUnits);
|
||||||
|
})();
|
||||||
|
});
|
||||||
it('Outstanding subscriptions are cancelled when zeroEx.setProviderAsync called', (done: DoneCallback) => {
|
it('Outstanding subscriptions are cancelled when zeroEx.setProviderAsync called', (done: DoneCallback) => {
|
||||||
(async () => {
|
(async () => {
|
||||||
const subscriptionOpts: SubscriptionOpts = {
|
const subscriptionOpts: SubscriptionOpts = {
|
||||||
|
Reference in New Issue
Block a user