summaryrefslogtreecommitdiff
path: root/test/parallel/test-tls-snicallback-error.js
blob: 307a359ebb2ab1dcdbcdc7d7759a70fcfc705807 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
'use strict';
const common = require('../common');
if (!common.hasCrypto)
  common.skip('missing crypto');

if (!process.features.tls_sni)
  common.skip('compiled without OpenSSL or with old OpenSSL version');

const assert = require('assert');
const tls = require('tls');

['fhqwhgads', 42, {}, []].forEach((testValue) => {
  assert.throws(
    () => { tls.createServer({ SNICallback: testValue }); },
    { code: 'ERR_INVALID_ARG_TYPE', message: /\boptions\.SNICallback\b/ }
  );
});