From 377eb22bf55712e8367f8ab1f947f6b6dc745cc4 Mon Sep 17 00:00:00 2001 From: suryagh Date: Sat, 14 May 2016 15:08:12 -0400 Subject: [PATCH] test: added tests for https-agent-getname MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit PR-URL: https://github.com/nodejs/node/pull/6762 Reviewed-By: James M Snell Reviewed-By: Brian White Reviewed-By: Colin Ihrig Reviewed-By: Fedor Indutny Reviewed-By: Johan Bergström --- 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 0000000000..63473775b0 --- /dev/null +++ b/test/parallel/test-https-agent-getname.js @@ -0,0 +1,32 @@ +'use strict'; + +require('../common'); +const assert = require('assert'); +const https = require('https'); + +const agent = new https.Agent(); + +// empty options +assert.strictEqual( + agent.getName({}), + 'localhost:::::::::' +); + +// pass all options arguments +const options = { + host: '0.0.0.0', + port: 443, + 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:443:192.168.1.1:ca:cert:ciphers:key:pfx:false:localhost' +);