Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: intuitively handle current object context #17553

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
test: refactored to intuitive handle current object context
  • Loading branch information
mithunsasidharan committed Dec 9, 2017
commit d40cd89f091e6f339c646c86e41f282867b78266
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