test: favor arrow functions in callbacks
PR-URL: https://github.com/nodejs/node/pull/24425 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Ujjwal Sharma <usharma1998@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
8450d11292
commit
6363f21faf
@ -1,5 +1,6 @@
|
|||||||
'use strict';
|
'use strict';
|
||||||
const common = require('../common');
|
const common = require('../common');
|
||||||
|
const assert = require('assert');
|
||||||
|
|
||||||
if (!common.hasCrypto)
|
if (!common.hasCrypto)
|
||||||
common.skip('missing crypto');
|
common.skip('missing crypto');
|
||||||
@ -14,7 +15,7 @@ const options = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
const server = https.Server(options, function(req, res) {
|
const server = https.Server(options, (req, res) => {
|
||||||
res.writeHead(200);
|
res.writeHead(200);
|
||||||
res.end('hello world\n');
|
res.end('hello world\n');
|
||||||
});
|
});
|
||||||
@ -27,11 +28,11 @@ server.listen(0, function() {
|
|||||||
rejectUnauthorized: true,
|
rejectUnauthorized: true,
|
||||||
servername: 'agent1',
|
servername: 'agent1',
|
||||||
ca: options.ca
|
ca: options.ca
|
||||||
}, function(res) {
|
}, (res) => {
|
||||||
res.resume();
|
res.resume();
|
||||||
console.log(res.statusCode);
|
assert.strictEqual(res.statusCode, 200);
|
||||||
server.close();
|
server.close();
|
||||||
}).on('error', function(e) {
|
}).on('error', (e) => {
|
||||||
console.log(e.message);
|
console.log(e.message);
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user