summaryrefslogtreecommitdiff
path: root/test/parallel/test-http2-createsecureserver-nooptions.js
blob: 71764f5783e404822955e7a4695d1f2c79e04a50 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
'use strict';

const common = require('../common');
if (!common.hasCrypto)
  common.skip('missing crypto');

const http2 = require('http2');

const invalidOptions = [() => {}, 1, 'test', null];
const invalidArgTypeError = {
  type: TypeError,
  code: 'ERR_INVALID_ARG_TYPE',
  message: 'The "options" argument must be of type Object'
};

// Error if options are not passed to createSecureServer
invalidOptions.forEach((invalidOption) => {
  common.expectsError(
    () => http2.createSecureServer(invalidOption),
    invalidArgTypeError
  );
});