test: use arrow functions in callbacks

PR-URL: https://github.com/nodejs/node/pull/24441
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
This commit is contained in:
apoorvanand 2018-11-17 18:28:07 +05:30 committed by Rich Trott
parent 7d18e922ab
commit b5c5d206af

View File

@ -22,14 +22,14 @@ writer1._write = common.mustCall(function(chunk, encoding, cb) {
cb();
}, 1);
writer1.once('chunk-received', function() {
writer1.once('chunk-received', () => {
assert.strictEqual(
reader._readableState.awaitDrain,
0,
'awaitDrain initial value should be 0, actual is ' +
reader._readableState.awaitDrain
);
setImmediate(function() {
setImmediate(() => {
// This one should *not* get through to writer1 because writer2 is not
// "done" processing.
reader.push(buffer);
@ -37,7 +37,7 @@ writer1.once('chunk-received', function() {
});
// A "slow" consumer:
writer2._write = common.mustCall(function(chunk, encoding, cb) {
writer2._write = common.mustCall((chunk, encoding, cb) => {
assert.strictEqual(
reader._readableState.awaitDrain,
1,
@ -49,7 +49,7 @@ writer2._write = common.mustCall(function(chunk, encoding, cb) {
// will return false.
}, 1);
writer3._write = common.mustCall(function(chunk, encoding, cb) {
writer3._write = common.mustCall((chunk, encoding, cb) => {
assert.strictEqual(
reader._readableState.awaitDrain,
2,