diff options
author | amaurer <git@maurer.me> | 2018-10-06 22:06:34 +0800 |
---|---|---|
committer | amaurer <git@maurer.me> | 2018-10-06 22:06:34 +0800 |
commit | bd3f101ab8735f97646d1031126fb9e55b67a93d (patch) | |
tree | d5c9335b84c185dd80f7ad5a13fc8a044682088a /packages/order-watcher/test | |
parent | 119f8c94495a15ef43298a77abc87fb9d33b4bb3 (diff) | |
download | dexon-0x-contracts-bd3f101ab8735f97646d1031126fb9e55b67a93d.tar.gz dexon-0x-contracts-bd3f101ab8735f97646d1031126fb9e55b67a93d.tar.zst dexon-0x-contracts-bd3f101ab8735f97646d1031126fb9e55b67a93d.zip |
Added orderWatchCount to return total count of orders watched.
Diffstat (limited to 'packages/order-watcher/test')
-rw-r--r-- | packages/order-watcher/test/order_watcher_test.ts | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/packages/order-watcher/test/order_watcher_test.ts b/packages/order-watcher/test/order_watcher_test.ts index 60d9069e8..f504dda8e 100644 --- a/packages/order-watcher/test/order_watcher_test.ts +++ b/packages/order-watcher/test/order_watcher_test.ts @@ -140,6 +140,23 @@ describe('OrderWatcher', () => { expect(() => orderWatcher.subscribe(_.noop.bind(_))).to.throw(OrderWatcherError.SubscriptionAlreadyPresent); }); }); + describe('#getWatchCount', async () => { + it('should increment and decrement order counts', async() => { + signedOrder = await fillScenarios.createFillableSignedOrderAsync( + makerAssetData, + takerAssetData, + makerAddress, + takerAddress, + fillableAmount, + ); + const orderHash = orderHashUtils.getOrderHashHex(signedOrder); + expect(orderWatcher.getWatchCount()).to.be.eq(0); + await orderWatcher.addOrderAsync(signedOrder); + expect(orderWatcher.getWatchCount()).to.be.eq(1); + orderWatcher.removeOrder(orderHash); + expect(orderWatcher.getWatchCount()).to.be.eq(0); + }); + }); describe('tests with cleanup', async () => { afterEach(async () => { orderWatcher.unsubscribe(); |