aboutsummaryrefslogtreecommitdiffstats
path: root/test/order_state_watcher_test.ts
diff options
context:
space:
mode:
authorLeonid Logvinov <logvinov.leon@gmail.com>2017-11-10 04:18:08 +0800
committerLeonid Logvinov <logvinov.leon@gmail.com>2017-11-10 04:30:22 +0800
commit31f6934787f5f6d06abba4f488ce49f6d0cdbbee (patch)
tree63e0c82c5913ec82e8f6dcff1b0a4b50d7665b4e /test/order_state_watcher_test.ts
parentc5dc89886df6210d6bb49772d35951773ed5c86a (diff)
downloaddexon-0x-contracts-31f6934787f5f6d06abba4f488ce49f6d0cdbbee.tar.gz
dexon-0x-contracts-31f6934787f5f6d06abba4f488ce49f6d0cdbbee.tar.zst
dexon-0x-contracts-31f6934787f5f6d06abba4f488ce49f6d0cdbbee.zip
Add a test that a second subscription fails
Diffstat (limited to 'test/order_state_watcher_test.ts')
-rw-r--r--test/order_state_watcher_test.ts14
1 files changed, 14 insertions, 0 deletions
diff --git a/test/order_state_watcher_test.ts b/test/order_state_watcher_test.ts
index 5569d2354..913ccf602 100644
--- a/test/order_state_watcher_test.ts
+++ b/test/order_state_watcher_test.ts
@@ -84,6 +84,20 @@ describe('OrderStateWatcher', () => {
zeroEx.orderStateWatcher.removeOrder(nonExistentOrderHash);
});
});
+ describe('#subscribe', async () => {
+ afterEach(async () => {
+ zeroEx.orderStateWatcher.unsubscribe();
+ });
+ it('should fail when trying to subscribe twice', (done: DoneCallback) => {
+ zeroEx.orderStateWatcher.subscribe(_.noop);
+ try {
+ zeroEx.orderStateWatcher.subscribe(_.noop);
+ done(new Error('Expected the second subscription to fail'));
+ } catch (err) {
+ done();
+ }
+ });
+ });
describe('tests with cleanup', async () => {
afterEach(async () => {
zeroEx.orderStateWatcher.unsubscribe();