mirror of
https://github.com/nodejs/node.git
synced 2024-11-21 10:59:27 +00:00
8b51c1a869
Co-authored-by: Antoine du Hamel <duhamelantoine1995@gmail.com> PR-URL: https://github.com/nodejs/node/pull/46790 Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: Robert Nagy <ronagy@icloud.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
32 lines
876 B
JavaScript
32 lines
876 B
JavaScript
'use strict';
|
|
|
|
const common = require('../common');
|
|
|
|
// This test verifies that `tls.connect()` honors the `hints` option.
|
|
|
|
if (!common.hasCrypto)
|
|
common.skip('missing crypto');
|
|
|
|
const assert = require('assert');
|
|
const dns = require('dns');
|
|
const tls = require('tls');
|
|
|
|
const hints = 512;
|
|
|
|
assert.notStrictEqual(hints, dns.ADDRCONFIG);
|
|
assert.notStrictEqual(hints, dns.V4MAPPED);
|
|
assert.notStrictEqual(hints, dns.ALL);
|
|
assert.notStrictEqual(hints, dns.ADDRCONFIG | dns.V4MAPPED);
|
|
assert.notStrictEqual(hints, dns.ADDRCONFIG | dns.ALL);
|
|
assert.notStrictEqual(hints, dns.V4MAPPED | dns.ALL);
|
|
assert.notStrictEqual(hints, dns.ADDRCONFIG | dns.V4MAPPED | dns.ALL);
|
|
|
|
tls.connect({
|
|
port: 42,
|
|
lookup: common.mustCall((host, options) => {
|
|
assert.strictEqual(host, 'localhost');
|
|
assert.deepStrictEqual(options, { family: undefined, hints, all: true });
|
|
}),
|
|
hints
|
|
});
|