aboutsummaryrefslogtreecommitdiffstats
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
parentc5dc89886df6210d6bb49772d35951773ed5c86a (diff)
downloaddexon-sol-tools-31f6934787f5f6d06abba4f488ce49f6d0cdbbee.tar
dexon-sol-tools-31f6934787f5f6d06abba4f488ce49f6d0cdbbee.tar.gz
dexon-sol-tools-31f6934787f5f6d06abba4f488ce49f6d0cdbbee.tar.bz2
dexon-sol-tools-31f6934787f5f6d06abba4f488ce49f6d0cdbbee.tar.lz
dexon-sol-tools-31f6934787f5f6d06abba4f488ce49f6d0cdbbee.tar.xz
dexon-sol-tools-31f6934787f5f6d06abba4f488ce49f6d0cdbbee.tar.zst
dexon-sol-tools-31f6934787f5f6d06abba4f488ce49f6d0cdbbee.zip
Add a test that a second subscription fails
-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();