summaryrefslogtreecommitdiff
path: root/test/sequential/test-tls-lookup.js
blob: 568ba1350675e1e153818e653484ab9bc4150d0e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
'use strict';
const common = require('../common');
if (!common.hasCrypto)
  common.skip('missing crypto');

const tls = require('tls');

['foobar', 1, {}, []].forEach(function connectThrows(input) {
  const opts = {
    host: 'localhost',
    port: common.PORT,
    lookup: input
  };

  common.expectsError(function() {
    tls.connect(opts);
  }, {
    code: 'ERR_INVALID_ARG_TYPE',
    type: TypeError
  });
});

connectDoesNotThrow(common.mustCall(() => {}));

function connectDoesNotThrow(input) {
  const opts = {
    host: 'localhost',
    port: common.PORT,
    lookup: input
  };

  tls.connect(opts);
}