summaryrefslogtreecommitdiff
path: root/test/parallel/test-http2-createsecureserver-nooptions.js
blob: 767797febc48f06243455f26fb87e3158445c3f7 (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 assert = require('assert');
const http2 = require('http2');

// Error if options are not passed to createSecureServer
const invalidOptions = [() => {}, 1, 'test', null];
invalidOptions.forEach((invalidOption) => {
  assert.throws(
    () => http2.createSecureServer(invalidOption),
    {
      name: 'TypeError [ERR_INVALID_ARG_TYPE]',
      code: 'ERR_INVALID_ARG_TYPE',
      message: 'The "options" argument must be of type Object. Received ' +
               `type ${typeof invalidOption}`
    }
  );
});