• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1'use strict';
2
3const common = require('../common');
4
5// This test verifies that `tls.connect()` honors the `hints` option.
6
7if (!common.hasCrypto)
8  common.skip('missing crypto');
9
10const assert = require('assert');
11const dns = require('dns');
12const tls = require('tls');
13
14const hints = 512;
15
16assert.notStrictEqual(hints, dns.ADDRCONFIG);
17assert.notStrictEqual(hints, dns.V4MAPPED);
18assert.notStrictEqual(hints, dns.ALL);
19assert.notStrictEqual(hints, dns.ADDRCONFIG | dns.V4MAPPED);
20assert.notStrictEqual(hints, dns.ADDRCONFIG | dns.ALL);
21assert.notStrictEqual(hints, dns.V4MAPPED | dns.ALL);
22assert.notStrictEqual(hints, dns.ADDRCONFIG | dns.V4MAPPED | dns.ALL);
23
24tls.connect({
25  port: 42,
26  lookup: common.mustCall((host, options) => {
27    assert.strictEqual(host, 'localhost');
28    assert.deepStrictEqual(options, { family: undefined, hints });
29  }),
30  hints
31});
32