diff options
author | sreepurnajasti <sreepurna.jasti@gmail.com> | 2018-11-20 12:49:01 +0530 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2018-11-24 06:44:52 +0900 |
commit | c90b51427503fe409f38da18a4966926cbe62564 (patch) | |
tree | 5e701c996a49dbccc9371fed3298f78ed07ed8a1 /test | |
parent | d45e303ac67c027bbad709f465e479ac789302a7 (diff) | |
download | android-node-v8-c90b51427503fe409f38da18a4966926cbe62564.tar.gz android-node-v8-c90b51427503fe409f38da18a4966926cbe62564.tar.bz2 android-node-v8-c90b51427503fe409f38da18a4966926cbe62564.zip |
test: replace callback with arrow functions
PR-URL: https://github.com/nodejs/node/pull/24541
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Diffstat (limited to 'test')
-rw-r--r-- | test/pummel/test-net-throttle.js | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/test/pummel/test-net-throttle.js b/test/pummel/test-net-throttle.js index acd8e0cc00..190c242d6e 100644 --- a/test/pummel/test-net-throttle.js +++ b/test/pummel/test-net-throttle.js @@ -34,7 +34,7 @@ const body = 'C'.repeat(N); console.log(`start server on port ${common.PORT}`); -const server = net.createServer(function(connection) { +const server = net.createServer((connection) => { connection.write(body.slice(0, part_N)); connection.write(body.slice(part_N, 2 * part_N)); assert.strictEqual(connection.write(body.slice(2 * part_N, N)), false); @@ -44,11 +44,11 @@ const server = net.createServer(function(connection) { connection.end(); }); -server.listen(common.PORT, function() { +server.listen(common.PORT, () => { let paused = false; const client = net.createConnection(common.PORT); client.setEncoding('ascii'); - client.on('data', function(d) { + client.on('data', (d) => { chars_recved += d.length; console.log(`got ${chars_recved}`); if (!paused) { @@ -57,7 +57,7 @@ server.listen(common.PORT, function() { paused = true; console.log('pause'); const x = chars_recved; - setTimeout(function() { + setTimeout(() => { assert.strictEqual(chars_recved, x); client.resume(); console.log('resume'); @@ -66,14 +66,14 @@ server.listen(common.PORT, function() { } }); - client.on('end', function() { + client.on('end', () => { server.close(); client.end(); }); }); -process.on('exit', function() { +process.on('exit', () => { assert.strictEqual(chars_recved, N); assert.strictEqual(npauses > 2, true); }); |