diff --git a/index.d.ts b/index.d.ts index 771022e..e4a6b9d 100644 --- a/index.d.ts +++ b/index.d.ts @@ -16,7 +16,7 @@ export class UserCredentials { } export class PersistentSubscriptionSettings { - constructor(resolveLinkTos: boolean, startFrom: number, extraStatistics: boolean, messageTimeout: number, + constructor(resolveLinkTos: boolean, startFrom: Long|number, extraStatistics: boolean, messageTimeout: number, maxRetryCount: number, liveBufferSize: number, readBatchSize: number, historyBufferSize: number, checkPointAfter: number, minCheckPointCount: number, maxCheckPointCount: number, maxSubscriberCount: number, namedConsumerStrategy: string) @@ -108,7 +108,7 @@ export interface WriteResult { export interface RecordedEvent { readonly eventStreamId: string; readonly eventId: string; - readonly eventNumber: number; + readonly eventNumber: Long; readonly eventType: string; readonly createdEpoch: number; readonly data?: Buffer; @@ -123,17 +123,17 @@ export interface ResolvedEvent { readonly isResolved: boolean; readonly originalPosition?: Position; readonly originalStreamId: string; - readonly originalEventNumber: number; + readonly originalEventNumber: Long; } export interface StreamEventsSlice { readonly status: string; // TODO: enum readonly stream: string; - readonly fromEventNumber: number; + readonly fromEventNumber: Long; readonly readDirection: string; // TODO: enum readonly events: ResolvedEvent[]; - readonly nextEventNumber: number; - readonly lastEventNumber: number; + readonly nextEventNumber: Long; + readonly lastEventNumber: Long; readonly isEndOfStream: boolean; } @@ -159,7 +159,7 @@ export interface EventStoreTransaction { export interface EventReadResult { readonly status: string; readonly stream: string; - readonly eventNumber: number; + readonly eventNumber: Long; readonly event: ResolvedEvent | null; } @@ -167,7 +167,7 @@ export interface EventStoreSubscription { readonly isSubscribedToAll: boolean; readonly streamId: string; readonly lastCommitPosition: Position; - readonly lastEventNumber: number; + readonly lastEventNumber: Long; close(): void; unsubscribe(): void; @@ -254,9 +254,9 @@ export interface EventStoreNodeConnection { startTransaction(stream: string, expectedVersion: Long|number, userCredentials?: UserCredentials): Promise; continueTransaction(transactionId: number, userCredentials?: UserCredentials): EventStoreTransaction; // read actions - readEvent(stream: string, eventNumber: number, resolveLinkTos?: boolean, userCredentials?: UserCredentials): Promise; - readStreamEventsForward(stream: string, start: number, count: number, resolveLinkTos?: boolean, userCredentials?: UserCredentials): Promise; - readStreamEventsBackward(stream: string, start: number, count: number, resolveLinkTos?: boolean, userCredentials?: UserCredentials): Promise; + readEvent(stream: string, eventNumber: Long|number, resolveLinkTos?: boolean, userCredentials?: UserCredentials): Promise; + readStreamEventsForward(stream: string, start: Long|number, count: number, resolveLinkTos?: boolean, userCredentials?: UserCredentials): Promise; + readStreamEventsBackward(stream: string, start: Long|number, count: number, resolveLinkTos?: boolean, userCredentials?: UserCredentials): Promise; readAllEventsForward(position: Position, maxCount: number, resolveLinkTos?: boolean, userCredentials?: UserCredentials): Promise; readAllEventsBackward(position: Position, maxCount: number, resolveLinkTos?: boolean, userCredentials?: UserCredentials): Promise; // subscription actions diff --git a/src/common/utils/ensure.js b/src/common/utils/ensure.js index a00ce24..bec90e2 100644 --- a/src/common/utils/ensure.js +++ b/src/common/utils/ensure.js @@ -12,10 +12,11 @@ module.exports.notNull = function(value, name) { throw new TypeError(name + " should not be null."); }; -module.exports.isInteger = function isInteger(value, name) { +function isInteger(value, name) { if (typeof value !== 'number' || value % 1 !== 0) throw new TypeError(name + " should be an integer."); -}; +} +module.exports.isInteger = isInteger; module.exports.isLongOrInteger = function(value, name) { if (typeof value === 'number') { diff --git a/src/core/eventStoreConnectionLogicHandler.js b/src/core/eventStoreConnectionLogicHandler.js index 0a1e489..17c3670 100644 --- a/src/core/eventStoreConnectionLogicHandler.js +++ b/src/core/eventStoreConnectionLogicHandler.js @@ -407,7 +407,7 @@ EventStoreConnectionLogicHandler.prototype._goToIdentifiedState = function() { }; var dto = new ClientMessage.IdentifyClient({version: ClientVersion, connectionName: this._esConnection.connectionName}); var buf = dto.constructor.encode(dto).finish(); - this._connection.enqueueSend(new TcpPackage(TcpCommand.IdentifyClient, this._identityInfo.correlationId, null, null, createBufferSegment(buf))) + this._connection.enqueueSend(new TcpPackage(TcpCommand.IdentifyClient, TcpFlags.None, this._identityInfo.correlationId, null, null, createBufferSegment(buf))) }; EventStoreConnectionLogicHandler.prototype._goToConnectedState = function() { diff --git a/src/eventStoreNodeConnection.js b/src/eventStoreNodeConnection.js index 9acc568..0aa732e 100644 --- a/src/eventStoreNodeConnection.js +++ b/src/eventStoreNodeConnection.js @@ -1,5 +1,6 @@ var util = require('util'); var uuid = require('uuid'); +var Long = require('long'); var EventEmitter = require('events').EventEmitter; var ensure = require('./common/utils/ensure'); @@ -269,7 +270,7 @@ EventStoreNodeConnection.prototype.readEvent = function(stream, eventNumber, res * Reading a specific stream forwards (async) * @public * @param {string} stream - * @param {number} start + * @param {Long|number} start * @param {number} count * @param {boolean} [resolveLinkTos] * @param {UserCredentials} [userCredentials] @@ -279,7 +280,8 @@ EventStoreNodeConnection.prototype.readStreamEventsForward = function( stream, start, count, resolveLinkTos, userCredentials ) { ensure.notNullOrEmpty(stream, "stream"); - ensure.isInteger(start, "start"); + ensure.isLongOrInteger(start, "start"); + start = Long.fromValue(start); ensure.nonNegative(start, "start"); ensure.isInteger(count, "count"); ensure.positive(count, "count"); @@ -303,7 +305,7 @@ EventStoreNodeConnection.prototype.readStreamEventsForward = function( * Reading a specific stream backwards (async) * @public * @param {string} stream - * @param {number} start + * @param {Long|number} start * @param {number} count * @param {boolean} [resolveLinkTos] * @param {UserCredentials} [userCredentials] @@ -313,7 +315,8 @@ EventStoreNodeConnection.prototype.readStreamEventsBackward = function( stream, start, count, resolveLinkTos, userCredentials ) { ensure.notNullOrEmpty(stream, "stream"); - ensure.isInteger(start, "start"); + ensure.isLongOrInteger(start, "start"); + start = Long.fromValue(start); ensure.isInteger(count, "count"); ensure.positive(count, "count"); if (count > MaxReadSize) throw new Error(util.format("Count should be less than %d. For larger reads you should page.", MaxReadSize)); diff --git a/src/messages/messages.js b/src/messages/messages.js index 5e74f4e..81ab70b 100644 --- a/src/messages/messages.js +++ b/src/messages/messages.js @@ -841,6 +841,7 @@ if (!(reader instanceof $Reader)) reader = $Reader.create(reader); var end = length === undefined ? reader.len : reader.pos + length, message = new $root.EventStore.Client.Messages.ResolvedIndexedEvent(); + message.event = null; while (reader.pos < end) { var tag = reader.uint32(); switch (tag >>> 3) { diff --git a/src/persistentSubscriptionSettings.js b/src/persistentSubscriptionSettings.js index fe3623f..fba2b47 100644 --- a/src/persistentSubscriptionSettings.js +++ b/src/persistentSubscriptionSettings.js @@ -1,4 +1,6 @@ var SystemConsumerStrategies = require('./systemConsumerStrategies'); +var ensure = require('./common/utils/ensure'); +var Long = require('long'); function PersistentSubscriptionSettings( resolveLinkTos, startFrom, extraStatistics, messageTimeout, @@ -6,6 +8,9 @@ function PersistentSubscriptionSettings( checkPointAfter, minCheckPointCount, maxCheckPointCount, maxSubscriberCount, namedConsumerStrategy ) { + ensure.isLongOrInteger(startFrom); + startFrom = Long.fromValue(startFrom); + this.resolveLinkTos = resolveLinkTos; this.startFrom = startFrom; this.extraStatistics = extraStatistics; diff --git a/test/appendToStream_test.js b/test/appendToStream_test.js index 2c3d864..1ec815c 100644 --- a/test/appendToStream_test.js +++ b/test/appendToStream_test.js @@ -1,5 +1,6 @@ var uuid = require('uuid'); var client = require('../src/client'); +var Long = require('long'); module.exports = { 'Append One Event To Stream Happy Path': function(test) { @@ -7,7 +8,7 @@ module.exports = { var event = client.createJsonEventData(uuid.v4(), {a: Math.random(), b: uuid.v4()}, null, 'testEvent'); this.conn.appendToStream(this.testStreamName, client.expectedVersion.any, event) .then(function(result) { - test.areEqual("nextExpectedVersion", result.nextExpectedVersion, 0); + test.areEqual("nextExpectedVersion", result.nextExpectedVersion, Long.fromNumber(0)); test.ok(result.logPosition, "No log position in result."); test.done(); }) @@ -27,7 +28,7 @@ module.exports = { } this.conn.appendToStream(this.testStreamName, client.expectedVersion.any, events) .then(function(result) { - test.areEqual("result.nextExpectedVersion", result.nextExpectedVersion, expectedVersion); + test.areEqual("result.nextExpectedVersion", result.nextExpectedVersion, Long.fromNumber(expectedVersion)); test.ok(result.logPosition, "No log position in result."); test.done(); }) @@ -47,7 +48,7 @@ module.exports = { } this.conn.appendToStream(this.testStreamName, client.expectedVersion.any, events) .then(function(result) { - test.areEqual("result.nextExpectedVersion", result.nextExpectedVersion, expectedVersion); + test.areEqual("result.nextExpectedVersion", result.nextExpectedVersion, Long.fromNumber(expectedVersion)); test.ok(result.logPosition, "No log position in result."); test.done(); }) @@ -62,7 +63,7 @@ module.exports = { this.conn.appendToStream(this.testStreamName, client.expectedVersion.any, event) .then(function(result) { - test.areEqual("result.nextExpectedVersion", result.nextExpectedVersion, 0); + test.areEqual("result.nextExpectedVersion", result.nextExpectedVersion, Long.fromNumber(0)); test.ok(result.logPosition, "No log position in result."); test.done(); }) diff --git a/test/common/base_test.js b/test/common/base_test.js index 33665a5..b83573d 100644 --- a/test/common/base_test.js +++ b/test/common/base_test.js @@ -78,7 +78,7 @@ function testLiveEvent(name, event, evNumber) { this.ok(event.originalPosition instanceof client.Position, name + ".originalPosition is not an instance of Position"); this.ok(event.originalStreamId, name + ".originalStreamId not defined (or null)"); if (typeof evNumber === 'number') { - this.ok(event.originalEventNumber === evNumber, name + '.originalEventNumber expected ' + evNumber + ' got ' + event.originalEventNumber); + this.ok(event.originalEventNumber.toNumber() === evNumber, name + '.originalEventNumber expected ' + evNumber + ' got ' + event.originalEventNumber); } else { this.ok(typeof event.originalEventNumber === 'number', name + ".originalEventNumber is not a number"); } @@ -91,7 +91,7 @@ function testReadEvent(name, event, evNumber) { this.ok(event.originalPosition === null, name + ".originalPosition is not null"); this.ok(event.originalStreamId, name + ".originalStreamId not defined (or null)"); if (typeof evNumber === 'number') { - this.ok(event.originalEventNumber === evNumber, name + '.originalEventNumber expected ' + evNumber + ' got ' + event.originalEventNumber); + this.ok(event.originalEventNumber.toNumber() === evNumber, name + '.originalEventNumber expected ' + evNumber + ' got ' + event.originalEventNumber); } else { this.ok(typeof event.originalEventNumber === 'number', name + ".originalEventNumber is not a number"); } diff --git a/test/readEvent_test.js b/test/readEvent_test.js index 365f1b5..6323be0 100644 --- a/test/readEvent_test.js +++ b/test/readEvent_test.js @@ -1,7 +1,7 @@ var util = require('util'); var uuid = require('uuid'); var client = require('../src/client'); - +var Long = require('long'); module.exports = { setUp: function(cb) { @@ -25,7 +25,7 @@ module.exports = { .then(function(result) { test.areEqual('status', result.status, client.eventReadStatus.Success); test.areEqual('stream', result.stream, self.testStreamName); - test.areEqual('eventNumber', result.eventNumber, 0); + test.areEqual('eventNumber', result.eventNumber, Long.fromNumber(0)); test.ok(result.event !== null, "event is null."); test.ok(result.event.originalEvent !== null, "event.originalEvent is null."); var event = JSON.parse(result.event.originalEvent.data.toString()); @@ -45,7 +45,7 @@ module.exports = { .then(function(result) { test.areEqual('status', result.status, client.eventReadStatus.NoStream); test.areEqual('stream', result.stream, anotherStream); - test.areEqual('eventNumber', result.eventNumber, 0); + test.areEqual('eventNumber', result.eventNumber, Long.fromNumber(0)); test.areEqual('event', result.event, null); test.done(); }) @@ -63,7 +63,7 @@ module.exports = { .then(function(result) { test.areEqual('status', result.status, client.eventReadStatus.StreamDeleted); test.areEqual('stream', result.stream, self.testStreamName); - test.areEqual('eventNumber', result.eventNumber, 0); + test.areEqual('eventNumber', result.eventNumber, Long.fromNumber(0)); test.areEqual('event', result.event, null); test.done(); }) @@ -78,7 +78,7 @@ module.exports = { .then(function(result) { test.areEqual('status', result.status, client.eventReadStatus.NotFound); test.areEqual('stream', result.stream, self.testStreamName); - test.areEqual('eventNumber', result.eventNumber, 1); + test.areEqual('eventNumber', result.eventNumber, Long.fromNumber(1)); test.areEqual('event', result.event, null); test.done(); }) @@ -124,7 +124,7 @@ module.exports = { .then(function(result) { test.areEqual('status', result.status, client.eventReadStatus.Success); test.areEqual('stream', result.stream, self.testStreamName); - test.areEqual('eventNumber', result.eventNumber, 1); + test.areEqual('eventNumber', result.eventNumber, Long.fromNumber(1)); test.ok(result.event !== null, "event is null."); test.ok(result.event.originalEvent !== null, "event.originalEvent is null."); var event = JSON.parse(result.event.originalEvent.data.toString()); diff --git a/test/readStreamEventsBackward_test.js b/test/readStreamEventsBackward_test.js index 2fa632f..3d9dbe1 100644 --- a/test/readStreamEventsBackward_test.js +++ b/test/readStreamEventsBackward_test.js @@ -1,6 +1,7 @@ var util = require('util'); var uuid = require('uuid'); var client = require('../src/client'); +var Long = require('long'); const streamSize = 100; @@ -22,15 +23,15 @@ module.exports = { .then(function(slice) { test.areEqual('slice.status', slice.status, client.eventReadStatus.Success); test.areEqual('slice.stream', slice.stream, self.testStreamName); - test.areEqual('slice.fromEventNumber', slice.fromEventNumber, streamSize-1); + test.areEqual('slice.fromEventNumber', slice.fromEventNumber, Long.fromNumber(streamSize-1)); test.areEqual('slice.readDirection', slice.readDirection, 'backward'); - test.areEqual('slice.nextEventNumber', slice.nextEventNumber, -1); - test.areEqual('slice.lastEventNumber', slice.lastEventNumber, streamSize-1); + test.areEqual('slice.nextEventNumber', slice.nextEventNumber, Long.fromNumber(-1)); + test.areEqual('slice.lastEventNumber', slice.lastEventNumber, Long.fromNumber(streamSize-1)); test.areEqual('slice.isEndOfStream', slice.isEndOfStream, true); for(var i = 0; i < streamSize; i++) { var reverseIndex = streamSize - i - 1; test.eventEqualEventData('slice.events[' + i + ']', slice.events[i], self.eventsData[reverseIndex]); - test.areEqual('slice.events[' + i + '].originalEventNumber', slice.events[i].originalEventNumber, reverseIndex); + test.areEqual('slice.events[' + i + '].originalEventNumber', slice.events[i].originalEventNumber, Long.fromNumber(reverseIndex)); } test.done(); }) @@ -45,7 +46,7 @@ module.exports = { .then(function(slice) { test.areEqual('slice.status', slice.status, client.sliceReadStatus.StreamNotFound); test.areEqual('slice.stream', slice.stream, anotherStream); - test.areEqual('slice.fromEventNumber', slice.fromEventNumber, streamSize-1); + test.areEqual('slice.fromEventNumber', slice.fromEventNumber, Long.fromNumber(streamSize-1)); test.areEqual('slice.events.length', slice.events.length, 0); test.done(); }) @@ -63,7 +64,7 @@ module.exports = { .then(function(slice) { test.areEqual('slice.status', slice.status, client.eventReadStatus.StreamDeleted); test.areEqual('slice.stream', slice.stream, self.testStreamName); - test.areEqual('slice.fromEventNumber', slice.fromEventNumber, streamSize-1); + test.areEqual('slice.fromEventNumber', slice.fromEventNumber, Long.fromNumber(streamSize-1)); test.areEqual('slice.events.length', slice.events.length, 0); test.done(); }) @@ -78,7 +79,7 @@ module.exports = { .then(function(slice) { test.areEqual('slice.status', slice.status, client.eventReadStatus.Success); test.areEqual('slice.stream', slice.stream, self.testStreamName); - test.areEqual('slice.fromEventNumber', slice.fromEventNumber, streamSize*2); + test.areEqual('slice.fromEventNumber', slice.fromEventNumber, Long.fromNumber(streamSize*2)); test.areEqual('slice.events.length', slice.events.length, 0); test.done(); }) diff --git a/test/readStreamEventsForward_test.js b/test/readStreamEventsForward_test.js index 3db9d31..0391bb4 100644 --- a/test/readStreamEventsForward_test.js +++ b/test/readStreamEventsForward_test.js @@ -1,6 +1,7 @@ var util = require('util'); var uuid = require('uuid'); var client = require('../src/client'); +var Long = require('long'); const streamSize = 100; @@ -22,10 +23,10 @@ module.exports = { .then(function(slice) { test.areEqual('slice.status', slice.status, client.eventReadStatus.Success); test.areEqual('slice.stream', slice.stream, self.testStreamName); - test.areEqual('slice.fromEventNumber', slice.fromEventNumber, 0); + test.areEqual('slice.fromEventNumber', slice.fromEventNumber, Long.fromNumber(0)); test.areEqual('slice.readDirection', slice.readDirection, 'forward'); - test.areEqual('slice.nextEventNumber', slice.nextEventNumber, streamSize); - test.areEqual('slice.lastEventNumber', slice.lastEventNumber, streamSize-1); + test.areEqual('slice.nextEventNumber', slice.nextEventNumber, Long.fromNumber(streamSize)); + test.areEqual('slice.lastEventNumber', slice.lastEventNumber, Long.fromNumber(streamSize-1)); test.areEqual('slice.isEndOfStream', slice.isEndOfStream, true); for(var i = 0; i < streamSize; i++) { test.eventEqualEventData('slice.events[' + i + ']', slice.events[i], self.eventsData[i]); @@ -44,7 +45,7 @@ module.exports = { .then(function(slice) { test.areEqual('slice.status', slice.status, client.sliceReadStatus.StreamNotFound); test.areEqual('slice.stream', slice.stream, anotherStream); - test.areEqual('slice.fromEventNumber', slice.fromEventNumber, 0); + test.areEqual('slice.fromEventNumber', slice.fromEventNumber, Long.fromNumber(0)); test.areEqual('slice.events.length', slice.events.length, 0); test.done(); }) @@ -62,7 +63,7 @@ module.exports = { .then(function(slice) { test.areEqual('slice.status', slice.status, client.eventReadStatus.StreamDeleted); test.areEqual('slice.stream', slice.stream, self.testStreamName); - test.areEqual('slice.fromEventNumber', slice.fromEventNumber, 0); + test.areEqual('slice.fromEventNumber', slice.fromEventNumber, Long.fromNumber(0)); test.areEqual('slice.events.length', slice.events.length, 0); test.done(); }) @@ -77,7 +78,7 @@ module.exports = { .then(function(slice) { test.areEqual('slice.status', slice.status, client.eventReadStatus.Success); test.areEqual('slice.stream', slice.stream, self.testStreamName); - test.areEqual('slice.fromEventNumber', slice.fromEventNumber, streamSize*2); + test.areEqual('slice.fromEventNumber', slice.fromEventNumber, Long.fromNumber(streamSize*2)); test.areEqual('slice.events.length', slice.events.length, 0); test.done(); }) diff --git a/test/subscribeToStreamFrom_test.js b/test/subscribeToStreamFrom_test.js index 8e1b78f..049523f 100644 --- a/test/subscribeToStreamFrom_test.js +++ b/test/subscribeToStreamFrom_test.js @@ -22,7 +22,7 @@ function delayOnlyFirst(count, action) { module.exports = { 'Test Subscribe to Stream From Beginning (null)': function(test) { - test.expect(36); + test.expect(32); var self = this; var liveProcessing = false; var catchUpEvents = []; @@ -57,15 +57,11 @@ module.exports = { } function subscriptionDropped(connection, reason, error) { test.ok(liveEvents.length === 2, "Expecting 2 live event, got " + liveEvents.length); - test.testLiveEvent('liveEvents[0]', liveEvents[0]); - test.testLiveEvent('liveEvents[1]', liveEvents[1]); - test.ok(liveEvents[0].originalEventNumber, 2); - test.ok(liveEvents[1].originalEventNumber, 3); + test.testLiveEvent('liveEvents[0]', liveEvents[0], 2); + test.testLiveEvent('liveEvents[1]', liveEvents[1], 3); test.ok(catchUpEvents.length === 2, "Expecting 2 catchUp event, got " + catchUpEvents.length); - test.testReadEvent('catchUpEvents[0]', catchUpEvents[0]); - test.testReadEvent('catchUpEvents[1]', catchUpEvents[1]); - test.ok(liveEvents[0].originalEventNumber, 0); - test.ok(liveEvents[1].originalEventNumber, 1); + test.testReadEvent('catchUpEvents[0]', catchUpEvents[0], 0); + test.testReadEvent('catchUpEvents[1]', catchUpEvents[1], 1); done(error); } @@ -82,7 +78,7 @@ module.exports = { .catch(test.done); }, 'Test Subscribe to Stream From 0': function(test) { - test.expect(29); + test.expect(26); var self = this; var liveProcessing = false; var catchUpEvents = []; @@ -117,13 +113,10 @@ module.exports = { } function subscriptionDropped(connection, reason, error) { test.ok(liveEvents.length === 2, "Expecting 2 live event, got " + liveEvents.length); - test.testLiveEvent('liveEvents[0]', liveEvents[0]); - test.testLiveEvent('liveEvents[1]', liveEvents[1]); - test.ok(liveEvents[0].originalEventNumber, 2); - test.ok(liveEvents[1].originalEventNumber, 3); + test.testLiveEvent('liveEvents[0]', liveEvents[0], 2); + test.testLiveEvent('liveEvents[1]', liveEvents[1], 3); test.ok(catchUpEvents.length === 1, "Expecting 1 catchUp event, got " + catchUpEvents.length); - test.testReadEvent('catchUpEvents[0]', catchUpEvents[0]); - test.ok(liveEvents[0].originalEventNumber, 1); + test.testReadEvent('catchUpEvents[0]', catchUpEvents[0], 1); done(error); } diff --git a/test/subscribeToStream_test.js b/test/subscribeToStream_test.js index 4a93255..9effb9a 100644 --- a/test/subscribeToStream_test.js +++ b/test/subscribeToStream_test.js @@ -1,5 +1,6 @@ const uuid = require('uuid'); const client = require('../src/client'); +const Long = require('long'); function delay(ms) { return new Promise(function (resolve, reject) { @@ -58,7 +59,7 @@ module.exports = { .then(function(subscription) { test.areEqual("subscription.streamId", subscription.streamId, self.testStreamName); test.areEqual("subscription.isSubscribedToAll", subscription.isSubscribedToAll, false); - test.areEqual("subscription.lastEventNumber", subscription.lastEventNumber, client.expectedVersion.emptyStream); + test.areEqual("subscription.lastEventNumber", subscription.lastEventNumber, Long.fromNumber(client.expectedVersion.emptyStream)); return self.conn.appendToStream(self.testStreamName, client.expectedVersion.emptyStream, publishedEvents); }) diff --git a/test/transactions_test.js b/test/transactions_test.js index cdd1012..1d02eca 100644 --- a/test/transactions_test.js +++ b/test/transactions_test.js @@ -111,7 +111,7 @@ module.exports = { }) .then(function(result) { test.ok(result.logPosition, "Missing result.logPosition"); - test.areEqual("result.nextExpectedVersion", result.nextExpectedVersion, self.events.length-1); + test.areEqual("result.nextExpectedVersion", result.nextExpectedVersion, Long.fromNumber(self.events.length-1)); test.done(); }) .catch(test.done);