Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update redis.js so that revisions don't have to begin at 0 #133

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion test/storeTest.js
Original file line number Diff line number Diff line change
Expand Up @@ -2167,6 +2167,36 @@ types.forEach(function (type) {

});

if (type === 'redis') {
describe('when events do not start at revision 0', function () {

it('should return the events specified by the revMin and revMax', function (done) {

var firstEventMatcher = options.prefix + ':' + options.eventsCollectionName + ':*:*:*:*:' + 'idWithAgg' + ':*:0'
var revMin = 1
var revMax = 2

store.client.keys(firstEventMatcher, (err, keys) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In order to supported legacy node versions, and avoid the use of transpilers, arrow functions should be avoided.

if (err) { console.log(err) }

store.client.del(keys[0], (err, keysDeleted) => {
expect(keysDeleted).to.equal(1)

store.getEventsByRevision({ aggregateId: 'idWithAgg' }, revMin, revMax, function (err, evts) {
expect(err).not.to.be.ok();
expect(evts.length).to.eql(1);
expect(evts[0].aggregateId).to.eql(stream2[1].aggregateId);
expect(evts[0].commitStamp.getTime()).to.eql(stream2[1].commitStamp.getTime());
expect(evts[0].streamRevision).to.eql(stream2[1].streamRevision);

done();
});
})
})
})
})
}

});

});
Expand Down Expand Up @@ -2283,7 +2313,7 @@ types.forEach(function (type) {

});

describe('and limit it with skip and limit', function () {
describe('and limit it with revMin and revMax', function () {

it('it should return the correct events', function (done) {

Expand Down