summaryrefslogtreecommitdiff
path: root/test/sequential/test-https-connect-localport.js
diff options
context:
space:
mode:
authorRich Trott <rtrott@gmail.com>2019-03-23 09:42:30 -0700
committerRich Trott <rtrott@gmail.com>2019-03-24 07:56:25 -0700
commit4a40ea6894ec758fe7ede70439aaddee20cf398b (patch)
tree9cb2f06383a3ed456c33863302ce58f633fba8c1 /test/sequential/test-https-connect-localport.js
parentf5969f08a0be666b3e95a185fa34f9554a5f6ffc (diff)
downloadandroid-node-v8-4a40ea6894ec758fe7ede70439aaddee20cf398b.tar.gz
android-node-v8-4a40ea6894ec758fe7ede70439aaddee20cf398b.tar.bz2
android-node-v8-4a40ea6894ec758fe7ede70439aaddee20cf398b.zip
test: refactor test-https-connect-localport
Use arrow functions for callbacks. Replace uses of `this` with explicit variables. Add a trailing comma in a multiline object literal declaration. PR-URL: https://github.com/nodejs/node/pull/26881 Fixes: https://github.com/https://github.com/nodejs/node/issues/26862 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Daijiro Wachi <daijiro.wachi@gmail.com>
Diffstat (limited to 'test/sequential/test-https-connect-localport.js')
-rw-r--r--test/sequential/test-https-connect-localport.js14
1 files changed, 8 insertions, 6 deletions
diff --git a/test/sequential/test-https-connect-localport.js b/test/sequential/test-https-connect-localport.js
index 67b56c7d7d..e703fb2287 100644
--- a/test/sequential/test-https-connect-localport.js
+++ b/test/sequential/test-https-connect-localport.js
@@ -9,21 +9,23 @@ const https = require('https');
const assert = require('assert');
{
- https.createServer({
+ const server = https.createServer({
cert: fixtures.readKey('agent1-cert.pem'),
key: fixtures.readKey('agent1-key.pem'),
- }, common.mustCall(function(req, res) {
- this.close();
+ }, common.mustCall((req, res) => {
+ server.close();
res.end();
- })).listen(0, 'localhost', common.mustCall(function() {
- const port = this.address().port;
+ }));
+
+ server.listen(0, 'localhost', common.mustCall(() => {
+ const port = server.address().port;
const req = https.get({
host: 'localhost',
pathname: '/',
port,
family: 4,
localPort: common.PORT,
- rejectUnauthorized: false
+ rejectUnauthorized: false,
}, common.mustCall(() => {
assert.strictEqual(req.socket.localPort, common.PORT);
assert.strictEqual(req.socket.remotePort, port);