From b12204e27e2e68f223160cec6489388b46a8616e Mon Sep 17 00:00:00 2001 From: Nimit Date: Thu, 16 Apr 2020 11:20:39 +0530 Subject: [PATCH] test: changed function to arrow function Convert callback functions that are anonymous to arrow functions for better readability. Also adjusted the `this` object in places where that was required. PR-URL: https://github.com/nodejs/node/pull/32875 Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Colin Ihrig Reviewed-By: Gireesh Punathil Reviewed-By: Ruben Bridgewater --- test/parallel/test-net-after-close.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-net-after-close.js b/test/parallel/test-net-after-close.js index 641e61bd04c5d0..7d49780d001d6e 100644 --- a/test/parallel/test-net-after-close.js +++ b/test/parallel/test-net-after-close.js @@ -24,14 +24,14 @@ const common = require('../common'); const assert = require('assert'); const net = require('net'); -const server = net.createServer(common.mustCall(function(s) { +const server = net.createServer(common.mustCall((s) => { console.error('SERVER: got connection'); s.end(); })); -server.listen(0, common.mustCall(function() { - const c = net.createConnection(this.address().port); - c.on('close', common.mustCall(function() { +server.listen(0, common.mustCall(() => { + const c = net.createConnection(server.address().port); + c.on('close', common.mustCall(() => { console.error('connection closed'); assert.strictEqual(c._handle, null); // Calling functions / accessing properties of a closed socket should not