test: change callback function to arrow function
PR-URL: https://github.com/nodejs/node/pull/24421 Reviewed-By: Ouyang Yadong <oyydoibh@gmail.com> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
This commit is contained in:
parent
1dadaf90f6
commit
d964d276db
@ -32,14 +32,14 @@ let nChunks = 10;
|
|||||||
const chunk = Buffer.alloc(10, 'x');
|
const chunk = Buffer.alloc(10, 'x');
|
||||||
|
|
||||||
r._read = function(n) {
|
r._read = function(n) {
|
||||||
setImmediate(function() {
|
setImmediate(() => {
|
||||||
r.push(--nChunks === 0 ? null : chunk);
|
r.push(--nChunks === 0 ? null : chunk);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
let readAll = false;
|
let readAll = false;
|
||||||
const seen = [];
|
const seen = [];
|
||||||
r.on('readable', function() {
|
r.on('readable', () => {
|
||||||
let chunk;
|
let chunk;
|
||||||
while (chunk = r.read()) {
|
while (chunk = r.read()) {
|
||||||
seen.push(chunk.toString());
|
seen.push(chunk.toString());
|
||||||
@ -74,7 +74,7 @@ const expect =
|
|||||||
'xxxxxxxxxx',
|
'xxxxxxxxxx',
|
||||||
'yyyyy' ];
|
'yyyyy' ];
|
||||||
|
|
||||||
r.on('end', function() {
|
r.on('end', () => {
|
||||||
assert.deepStrictEqual(seen, expect);
|
assert.deepStrictEqual(seen, expect);
|
||||||
console.log('ok');
|
console.log('ok');
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user