2016-05-14 21:08:12 +02:00
|
|
|
'use strict';
|
|
|
|
|
2016-05-30 01:45:20 +02:00
|
|
|
const common = require('../common');
|
|
|
|
if (!common.hasCrypto) {
|
|
|
|
common.skip('missing crypto');
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
2016-05-14 21:08:12 +02:00
|
|
|
const assert = require('assert');
|
|
|
|
const https = require('https');
|
|
|
|
|
|
|
|
const agent = new https.Agent();
|
|
|
|
|
|
|
|
// empty options
|
|
|
|
assert.strictEqual(
|
|
|
|
agent.getName({}),
|
2016-11-02 23:20:12 +01:00
|
|
|
'localhost::::::::::'
|
2016-05-14 21:08:12 +02:00
|
|
|
);
|
|
|
|
|
|
|
|
// 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),
|
2016-11-02 23:20:12 +01:00
|
|
|
'0.0.0.0:443:192.168.1.1:ca:cert:ciphers:key:pfx:false:localhost:'
|
2016-05-14 21:08:12 +02:00
|
|
|
);
|