From c810d65e491481f49faf19ac36041a3f35e6322a 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. --- 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