1'use strict'; 2 3const common = require('../common'); 4if (!common.hasCrypto) 5 common.skip('missing crypto'); 6 7const assert = require('assert'); 8const https = require('https'); 9 10const agent = new https.Agent(); 11 12// empty argument 13assert.strictEqual( 14 agent.getName(), 15 'localhost::::::::::::::::::::::' 16); 17 18// empty options 19assert.strictEqual( 20 agent.getName({}), 21 'localhost::::::::::::::::::::::' 22); 23 24// Pass all options arguments 25const options = { 26 host: '0.0.0.0', 27 port: 443, 28 localAddress: '192.168.1.1', 29 ca: 'ca', 30 cert: 'cert', 31 clientCertEngine: 'dynamic', 32 ciphers: 'ciphers', 33 crl: [Buffer.from('c'), Buffer.from('r'), Buffer.from('l')], 34 dhparam: 'dhparam', 35 ecdhCurve: 'ecdhCurve', 36 honorCipherOrder: false, 37 key: 'key', 38 pfx: 'pfx', 39 rejectUnauthorized: false, 40 secureOptions: 0, 41 secureProtocol: 'secureProtocol', 42 servername: 'localhost', 43 sessionIdContext: 'sessionIdContext', 44 sigalgs: 'sigalgs', 45 privateKeyIdentifier: 'privateKeyIdentifier', 46 privateKeyEngine: 'privateKeyEngine', 47}; 48 49assert.strictEqual( 50 agent.getName(options), 51 '0.0.0.0:443:192.168.1.1:ca:cert:dynamic:ciphers:key:pfx:false:localhost:' + 52 '::secureProtocol:c,r,l:false:ecdhCurve:dhparam:0:sessionIdContext:' + 53 '"sigalgs":privateKeyIdentifier:privateKeyEngine' 54); 55