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:
parent
8d23afc807
commit
f3aaaa52b7
@ -83,14 +83,13 @@ const forAllClients = (cb) => common.mustCall(cb, CLIENT_VARIANTS);
|
|||||||
path: serverPath
|
path: serverPath
|
||||||
});
|
});
|
||||||
const getConnectCb = (index) => common.mustCall(function clientOnConnect() {
|
const getConnectCb = (index) => common.mustCall(function clientOnConnect() {
|
||||||
const client = this;
|
|
||||||
// Test if it's wrapping an existing fd
|
// Test if it's wrapping an existing fd
|
||||||
assert(handleMap.has(index));
|
assert(handleMap.has(index));
|
||||||
const oldHandle = handleMap.get(index);
|
const oldHandle = handleMap.get(index);
|
||||||
assert.strictEqual(oldHandle.fd, this._handle.fd);
|
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}`);
|
console.error(`[Pipe]Sending data through fd ${oldHandle.fd}`);
|
||||||
client.on('error', function(err) {
|
this.on('error', function(err) {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
assert.fail(null, null, `[Pipe Client]${err}`);
|
assert.fail(null, null, `[Pipe Client]${err}`);
|
||||||
});
|
});
|
||||||
|
@ -20,9 +20,8 @@ const CLIENT_VARIANTS = 12;
|
|||||||
}, CLIENT_VARIANTS))
|
}, CLIENT_VARIANTS))
|
||||||
.listen(serverPath, common.mustCall(function() {
|
.listen(serverPath, common.mustCall(function() {
|
||||||
const getConnectCb = () => common.mustCall(function() {
|
const getConnectCb = () => common.mustCall(function() {
|
||||||
const client = this;
|
this.end();
|
||||||
client.end();
|
this.on('close', common.mustCall(function() {
|
||||||
client.on('close', common.mustCall(function() {
|
|
||||||
counter++;
|
counter++;
|
||||||
if (counter === CLIENT_VARIANTS) {
|
if (counter === CLIENT_VARIANTS) {
|
||||||
server.close();
|
server.close();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user