11cb0ef41Sopenharmony_ci'use strict';
21cb0ef41Sopenharmony_ci
31cb0ef41Sopenharmony_ciconst common = require('../common');
41cb0ef41Sopenharmony_ciif (!common.hasCrypto)
51cb0ef41Sopenharmony_ci  common.skip('missing crypto');
61cb0ef41Sopenharmony_ci
71cb0ef41Sopenharmony_ciconst assert = require('assert');
81cb0ef41Sopenharmony_ciconst https = require('https');
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_ciconst agent = new https.Agent();
111cb0ef41Sopenharmony_ci
121cb0ef41Sopenharmony_ci// empty argument
131cb0ef41Sopenharmony_ciassert.strictEqual(
141cb0ef41Sopenharmony_ci  agent.getName(),
151cb0ef41Sopenharmony_ci  'localhost::::::::::::::::::::::'
161cb0ef41Sopenharmony_ci);
171cb0ef41Sopenharmony_ci
181cb0ef41Sopenharmony_ci// empty options
191cb0ef41Sopenharmony_ciassert.strictEqual(
201cb0ef41Sopenharmony_ci  agent.getName({}),
211cb0ef41Sopenharmony_ci  'localhost::::::::::::::::::::::'
221cb0ef41Sopenharmony_ci);
231cb0ef41Sopenharmony_ci
241cb0ef41Sopenharmony_ci// Pass all options arguments
251cb0ef41Sopenharmony_ciconst options = {
261cb0ef41Sopenharmony_ci  host: '0.0.0.0',
271cb0ef41Sopenharmony_ci  port: 443,
281cb0ef41Sopenharmony_ci  localAddress: '192.168.1.1',
291cb0ef41Sopenharmony_ci  ca: 'ca',
301cb0ef41Sopenharmony_ci  cert: 'cert',
311cb0ef41Sopenharmony_ci  clientCertEngine: 'dynamic',
321cb0ef41Sopenharmony_ci  ciphers: 'ciphers',
331cb0ef41Sopenharmony_ci  crl: [Buffer.from('c'), Buffer.from('r'), Buffer.from('l')],
341cb0ef41Sopenharmony_ci  dhparam: 'dhparam',
351cb0ef41Sopenharmony_ci  ecdhCurve: 'ecdhCurve',
361cb0ef41Sopenharmony_ci  honorCipherOrder: false,
371cb0ef41Sopenharmony_ci  key: 'key',
381cb0ef41Sopenharmony_ci  pfx: 'pfx',
391cb0ef41Sopenharmony_ci  rejectUnauthorized: false,
401cb0ef41Sopenharmony_ci  secureOptions: 0,
411cb0ef41Sopenharmony_ci  secureProtocol: 'secureProtocol',
421cb0ef41Sopenharmony_ci  servername: 'localhost',
431cb0ef41Sopenharmony_ci  sessionIdContext: 'sessionIdContext',
441cb0ef41Sopenharmony_ci  sigalgs: 'sigalgs',
451cb0ef41Sopenharmony_ci  privateKeyIdentifier: 'privateKeyIdentifier',
461cb0ef41Sopenharmony_ci  privateKeyEngine: 'privateKeyEngine',
471cb0ef41Sopenharmony_ci};
481cb0ef41Sopenharmony_ci
491cb0ef41Sopenharmony_ciassert.strictEqual(
501cb0ef41Sopenharmony_ci  agent.getName(options),
511cb0ef41Sopenharmony_ci  '0.0.0.0:443:192.168.1.1:ca:cert:dynamic:ciphers:key:pfx:false:localhost:' +
521cb0ef41Sopenharmony_ci    '::secureProtocol:c,r,l:false:ecdhCurve:dhparam:0:sessionIdContext:' +
531cb0ef41Sopenharmony_ci    '"sigalgs":privateKeyIdentifier:privateKeyEngine'
541cb0ef41Sopenharmony_ci);
55