aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-06-13 23:39:43 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-06-13 23:39:43 +0800
commit96a93c4b35673c951914e26d67140242c2a2de8f (patch)
tree6e4ea26976aacd1cb452c5c48b28d7dd7aaaf59f
parent870f9838d6743f5594fb809c6b91084be4d0cc45 (diff)
downloaddexon-sol-tools-96a93c4b35673c951914e26d67140242c2a2de8f.tar
dexon-sol-tools-96a93c4b35673c951914e26d67140242c2a2de8f.tar.gz
dexon-sol-tools-96a93c4b35673c951914e26d67140242c2a2de8f.tar.bz2
dexon-sol-tools-96a93c4b35673c951914e26d67140242c2a2de8f.tar.lz
dexon-sol-tools-96a93c4b35673c951914e26d67140242c2a2de8f.tar.xz
dexon-sol-tools-96a93c4b35673c951914e26d67140242c2a2de8f.tar.zst
dexon-sol-tools-96a93c4b35673c951914e26d67140242c2a2de8f.zip
Add tests for stopWatchingAsync
-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;