Skip to content

Commit

Permalink
test: remove third argument from assert.strictEqual()
Browse files Browse the repository at this point in the history
In file test/parallel/test-stream-transform-final.js the ten calls to
assert.strictEqual() use a string literal as third argument. When
a AssertionError occurs, it reports the string literal and not the
first two arguments, so the third agrument is removed and made a
comment just above the call to assert.strictEqual().

PR-URL: nodejs#22051
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
  • Loading branch information
rishabhptr authored and maclover7 committed Aug 3, 2018
1 parent ce98e2e commit 8d15f69
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions test/parallel/test-stream-transform-final.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,44 +59,54 @@ The order things are called
const t = new stream.Transform({
objectMode: true,
transform: common.mustCall(function(chunk, _, next) {
assert.strictEqual(++state, chunk, 'transformCallback part 1');
// transformCallback part 1
assert.strictEqual(++state, chunk);
this.push(state);
assert.strictEqual(++state, chunk + 2, 'transformCallback part 2');
// transformCallback part 2
assert.strictEqual(++state, chunk + 2);
process.nextTick(next);
}, 3),
final: common.mustCall(function(done) {
state++;
assert.strictEqual(state, 10, 'finalCallback part 1');
// finalCallback part 1
assert.strictEqual(state, 10);
setTimeout(function() {
state++;
assert.strictEqual(state, 11, 'finalCallback part 2');
// finalCallback part 2
assert.strictEqual(state, 11);
done();
}, 100);
}, 1),
flush: common.mustCall(function(done) {
state++;
assert.strictEqual(state, 12, 'flushCallback part 1');
// flushCallback part 1
assert.strictEqual(state, 12);
process.nextTick(function() {
state++;
assert.strictEqual(state, 15, 'flushCallback part 2');
// flushCallback part 2
assert.strictEqual(state, 15);
done();
});
}, 1)
});
t.on('finish', common.mustCall(function() {
state++;
assert.strictEqual(state, 13, 'finishListener');
// finishListener
assert.strictEqual(state, 13);
}, 1));
t.on('end', common.mustCall(function() {
state++;
assert.strictEqual(state, 16, 'end event');
// end event
assert.strictEqual(state, 16);
}, 1));
t.on('data', common.mustCall(function(d) {
assert.strictEqual(++state, d + 1, 'dataListener');
// dataListener
assert.strictEqual(++state, d + 1);
}, 3));
t.write(1);
t.write(4);
t.end(7, common.mustCall(function() {
state++;
assert.strictEqual(state, 14, 'endMethodCallback');
// endMethodCallback
assert.strictEqual(state, 14);
}, 1));

0 comments on commit 8d15f69

Please sign in to comment.