From f62d843b5923dc1c2589105fc282b5d6d3e880db Mon Sep 17 00:00:00 2001 From: suryagh Date: Sat, 14 May 2016 15:08:12 -0400 Subject: [PATCH 1/2] test: added tests for https-agent-getname --- test/parallel/test-https-agent-getname.js | 32 +++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 test/parallel/test-https-agent-getname.js diff --git a/test/parallel/test-https-agent-getname.js b/test/parallel/test-https-agent-getname.js new file mode 100644 index 00000000000000..bc9c1aec95eaf1 --- /dev/null +++ b/test/parallel/test-https-agent-getname.js @@ -0,0 +1,32 @@ +'use strict'; + +require('../common'); +var assert = require('assert'); +var https = require('https'); + +var agent = new https.Agent(); + +// empty options +assert.strictEqual( + agent.getName({}), + 'localhost:::::::::' +); + +// pass all options arguments +var options = { + host: '0.0.0.0', + port: 80, + localAddress: '192.168.1.1', + ca: 'ca', + cert: 'cert', + ciphers: 'ciphers', + key: 'key', + pfx: 'pfx', + rejectUnauthorized: false, + servername: 'localhost', +}; + +assert.strictEqual( + agent.getName(options), + '0.0.0.0:80:192.168.1.1:ca:cert:ciphers:key:pfx:false:localhost' +); From 2084001102a606a974621f3ccdf0c167beae4351 Mon Sep 17 00:00:00 2001 From: suryagh Date: Sun, 15 May 2016 09:09:48 -0400 Subject: [PATCH 2/2] test: use const and changed port to 443 --- test/parallel/test-https-agent-getname.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/parallel/test-https-agent-getname.js b/test/parallel/test-https-agent-getname.js index bc9c1aec95eaf1..63473775b0e0f6 100644 --- a/test/parallel/test-https-agent-getname.js +++ b/test/parallel/test-https-agent-getname.js @@ -1,10 +1,10 @@ 'use strict'; require('../common'); -var assert = require('assert'); -var https = require('https'); +const assert = require('assert'); +const https = require('https'); -var agent = new https.Agent(); +const agent = new https.Agent(); // empty options assert.strictEqual( @@ -13,9 +13,9 @@ assert.strictEqual( ); // pass all options arguments -var options = { +const options = { host: '0.0.0.0', - port: 80, + port: 443, localAddress: '192.168.1.1', ca: 'ca', cert: 'cert', @@ -28,5 +28,5 @@ var options = { assert.strictEqual( agent.getName(options), - '0.0.0.0:80:192.168.1.1:ca:cert:ciphers:key:pfx:false:localhost' + '0.0.0.0:443:192.168.1.1:ca:cert:ciphers:key:pfx:false:localhost' );