test: refactored to remove unnecessary variables

PR-URL: https://github.com/nodejs/node/pull/17553
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
Mithun Sasidharan 2017-12-08 22:44:28 +05:30 committed by Jon Moss
parent 8d23afc807
commit f3aaaa52b7
2 changed files with 4 additions and 6 deletions

View File

@ -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}`);
});

View File

@ -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();