aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--test/exchange_wrapper_test.ts20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/exchange_wrapper_test.ts b/test/exchange_wrapper_test.ts
index b9ac374dd..35e42e4b2 100644
--- a/test/exchange_wrapper_test.ts
+++ b/test/exchange_wrapper_test.ts
@@ -693,6 +693,26 @@ describe('ExchangeWrapper', () => {
);
})();
});
+ it('Should be able to stop watching', (done: DoneCallback) => {
+ (async () => {
+ const subscriptionOpts: SubscriptionOpts = {
+ fromBlock: 0,
+ toBlock: 'latest',
+ };
+ const eventSubscriptionToBeStopped = await zeroEx.exchange.subscribeAsync(
+ ExchangeEvents.LogFill, subscriptionOpts, indexFilterValues,
+ );
+ eventSubscriptionToBeStopped.watch((err: Error, event: ContractEvent) => {
+ done(new Error('Expected this subscription to have been stopped'));
+ });
+ await eventSubscriptionToBeStopped.stopWatchingAsync();
+ const fillTakerAmountInBaseUnits = new BigNumber(1);
+ await zeroEx.exchange.fillOrderAsync(
+ signedOrder, fillTakerAmountInBaseUnits, shouldCheckTransfer, takerAddress,
+ );
+ done();
+ })();
+ });
});
describe('#getOrderHashHexUsingContractCallAsync', () => {
let makerTokenAddress: string;