Skip to content

Commit c45660f

Browse files
suman-mitrarvagg
authored andcommitted
test: replace anonymous closure with arrow functions
PR-URL: #24481 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent 672a31c commit c45660f

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

test/pummel/test-net-pause.js

+9-9
Original file line numberDiff line numberDiff line change
@@ -28,44 +28,44 @@ const N = 200;
2828
let recv = '';
2929
let chars_recved = 0;
3030

31-
const server = net.createServer(function(connection) {
31+
const server = net.createServer((connection) => {
3232
function write(j) {
3333
if (j >= N) {
3434
connection.end();
3535
return;
3636
}
37-
setTimeout(function() {
37+
setTimeout(() => {
3838
connection.write('C');
3939
write(j + 1);
4040
}, 10);
4141
}
4242
write(0);
4343
});
4444

45-
server.on('listening', function() {
45+
server.on('listening', () => {
4646
const client = net.createConnection(common.PORT);
4747
client.setEncoding('ascii');
4848
client.on('data', function(d) {
4949
console.log(d);
5050
recv += d;
5151
});
5252

53-
setTimeout(function() {
53+
setTimeout(() => {
5454
chars_recved = recv.length;
5555
console.log(`pause at: ${chars_recved}`);
5656
assert.strictEqual(chars_recved > 1, true);
5757
client.pause();
58-
setTimeout(function() {
58+
setTimeout(() => {
5959
console.log(`resume at: ${chars_recved}`);
6060
assert.strictEqual(chars_recved, recv.length);
6161
client.resume();
6262

63-
setTimeout(function() {
63+
setTimeout(() => {
6464
chars_recved = recv.length;
6565
console.log(`pause at: ${chars_recved}`);
6666
client.pause();
6767

68-
setTimeout(function() {
68+
setTimeout(() => {
6969
console.log(`resume at: ${chars_recved}`);
7070
assert.strictEqual(chars_recved, recv.length);
7171
client.resume();
@@ -78,14 +78,14 @@ server.on('listening', function() {
7878

7979
}, 500);
8080

81-
client.on('end', function() {
81+
client.on('end', () => {
8282
server.close();
8383
client.end();
8484
});
8585
});
8686
server.listen(common.PORT);
8787

88-
process.on('exit', function() {
88+
process.on('exit', () => {
8989
assert.strictEqual(recv.length, N);
9090
console.error('Exit');
9191
});

0 commit comments

Comments
 (0)