Skip to content

Commit

Permalink
Add test for _all Consumer
Browse files Browse the repository at this point in the history
  • Loading branch information
albe committed Jun 12, 2021
1 parent c828984 commit 8ece5a2
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions test/EventStore.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -664,6 +664,23 @@ describe('EventStore', function() {
eventstore.commit('foo', { foo: 'bar', id: 2 });
});

it('can return a consumer for the _all stream', function(done) {
eventstore = new EventStore({
storageDirectory
});

const consumer = eventstore.getConsumer('_all', 'consumer1');
expect(consumer instanceof Consumer).to.be(true);
let i = 0;
consumer.on('data', event => {
expect(event.payload.id).to.be(++i);
if (i === 2) {
done();
}
});
eventstore.commit('foo', { foo: 'bar', id: 1 });
eventstore.commit('bar', { foo: 'baz', id: 2 });
});
});

});

0 comments on commit 8ece5a2

Please sign in to comment.