Skip to content

Commit

Permalink
[test] Test recombine option of the By stream
Browse files Browse the repository at this point in the history
  • Loading branch information
mmalecki committed Jun 13, 2013
1 parent b36908b commit 34de2c7
Showing 1 changed file with 25 additions and 3 deletions.
28 changes: 25 additions & 3 deletions test/reactor/by-test.js
Expand Up @@ -12,7 +12,8 @@ var assert = require('assert'),

var counts = {
service: 0,
'service+ttl': 0
'service+ttl': 0,
'service+recombine': 0
};

vows.describe('godot/reactor/by').addBatch({
Expand Down Expand Up @@ -40,11 +41,32 @@ vows.describe('godot/reactor/by').addBatch({
),
'by',
6
)
),
"service, recombine": macros.shouldEmitDataSync(
godot.reactor()
.by(
'service',
godot.reactor().map(function (data, callback) {
counts['service+recombine']++;

//
// Calling `callback` twice will cause `data` event to be emitted
// twice on the `Map` stream, thus resulting in doubling each
// message.
//
callback(null, data);
callback(null, data);
}),
{ recombine: true }
),
'by',
12
),
}
}).addBatch({
"Should emit pipe the events to the correct pipe-chains": function () {
assert.equal(counts.service, 6);
assert.equal(counts['service+ttl'], 12);
assert.equal(counts['service+recombine'], 6);
}
}).export(module);
}).export(module);

0 comments on commit 34de2c7

Please sign in to comment.