From d71d5651970dc7c6f79b1c688243340508e23772 Mon Sep 17 00:00:00 2001 From: Rob Date: Wed, 22 Mar 2017 10:12:53 +0200 Subject: [PATCH] [test] append to stream stress test --- test/appendToStream_test.js | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/test/appendToStream_test.js b/test/appendToStream_test.js index d23de74..120687c 100644 --- a/test/appendToStream_test.js +++ b/test/appendToStream_test.js @@ -35,6 +35,26 @@ module.exports = { test.done(err); }); }, + 'Append Multiple Events To Stream Happy Path Stress Test': function(test) { + test.expect(2); + const expectedVersion = 1000; + var events = []; + for(var i = 0; i <= expectedVersion; i++) { + if (i % 2 === 0) + events.push(client.createJsonEventData(uuid.v4(), {a: Math.random(), b: uuid.v4()}, null, 'testEvent')); + else + events.push(client.createJsonEventData(uuid.v4(), {b: Math.random(), a: uuid.v4()}, null, 'otherEvent')); + } + this.conn.appendToStream(this.testStreamName, client.expectedVersion.any, events) + .then(function(result) { + test.areEqual("result.nextExpectedVersion", result.nextExpectedVersion, expectedVersion); + test.ok(result.logPosition, "No log position in result."); + test.done(); + }) + .catch(function(err) { + test.done(err); + }); + }, 'Append To Stream Wrong Expected Version': function(test) { test.expect(1); var event = client.createJsonEventData(uuid.v4(), {a: Math.random(), b: uuid.v4()}, null, 'testEvent');