From 062e23bb2d3d8ee6bb08304b1be41c5ae555f764 Mon Sep 17 00:00:00 2001 From: Mithun Sasidharan Date: Fri, 8 Dec 2017 22:44:28 +0530 Subject: [PATCH] test: refactored to remove unnecessary variables PR-URL: https://github.com/nodejs/node/pull/17553 Reviewed-By: Jon Moss Reviewed-By: Luigi Pinca --- test/parallel/test-net-connect-options-fd.js | 5 ++--- test/parallel/test-net-connect-options-path.js | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/test/parallel/test-net-connect-options-fd.js b/test/parallel/test-net-connect-options-fd.js index 1ffc92257ced31..50c2a08efeb194 100644 --- a/test/parallel/test-net-connect-options-fd.js +++ b/test/parallel/test-net-connect-options-fd.js @@ -83,14 +83,13 @@ const forAllClients = (cb) => common.mustCall(cb, CLIENT_VARIANTS); path: serverPath }); const getConnectCb = (index) => common.mustCall(function clientOnConnect() { - const client = this; // Test if it's wrapping an existing fd assert(handleMap.has(index)); const oldHandle = handleMap.get(index); assert.strictEqual(oldHandle.fd, this._handle.fd); - client.write(String(oldHandle.fd)); + this.write(String(oldHandle.fd)); console.error(`[Pipe]Sending data through fd ${oldHandle.fd}`); - client.on('error', function(err) { + this.on('error', function(err) { console.error(err); assert.fail(null, null, `[Pipe Client]${err}`); }); diff --git a/test/parallel/test-net-connect-options-path.js b/test/parallel/test-net-connect-options-path.js index 07c5446fc6c0ab..3868b85a78a6d2 100644 --- a/test/parallel/test-net-connect-options-path.js +++ b/test/parallel/test-net-connect-options-path.js @@ -20,9 +20,8 @@ const CLIENT_VARIANTS = 12; }, CLIENT_VARIANTS)) .listen(serverPath, common.mustCall(function() { const getConnectCb = () => common.mustCall(function() { - const client = this; - client.end(); - client.on('close', common.mustCall(function() { + this.end(); + this.on('close', common.mustCall(function() { counter++; if (counter === CLIENT_VARIANTS) { server.close();