Add a test that a second subscription fails

This commit is contained in:
Leonid Logvinov
2017-11-09 15:18:08 -05:00
parent c5dc89886d
commit 31f6934787

View File

@@ -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();