test: changed function to arrow function

Convert callback functions that are anonymous
to arrow functions for better readability.
Also adjusted the `this` object in places where
that was required.

PR-URL: https://github.com/nodejs/node/pull/32875
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
Nimit authored and Michaël Zasso committed 2020-04-29 21:49:41 +02:00
1 parent 9c216640d7
commit f181b5996a
1 file changed
+4 -4
+4 -4
View File
@@ -24,14 +24,14 @@ const common = require('../common');
const assert = require('assert');
const net = require('net');
const server = net.createServer(common.mustCall(function(s) {
const server = net.createServer(common.mustCall((s) => {
console.error('SERVER: got connection');
s.end();
}));
server.listen(0, common.mustCall(function() {
const c = net.createConnection(this.address().port);
c.on('close', common.mustCall(function() {
server.listen(0, common.mustCall(() => {
const c = net.createConnection(server.address().port);
c.on('close', common.mustCall(() => {
console.error('connection closed');
assert.strictEqual(c._handle, null);
// Calling functions / accessing properties of a closed socket should not