Skip to content

Commit

Permalink
test: refactored to remove unnecessary variables
Browse files Browse the repository at this point in the history
PR-URL: #17553
Reviewed-By: Jon Moss <me@jonathanmoss.me>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
  • Loading branch information
mithunsasidharan authored and maclover7 committed Dec 11, 2017
1 parent 8d23afc commit f3aaaa5
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
5 changes: 2 additions & 3 deletions test/parallel/test-net-connect-options-fd.js
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
});
Expand Down
5 changes: 2 additions & 3 deletions test/parallel/test-net-connect-options-path.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit f3aaaa5

Please sign in to comment.