node/test/parallel/test-http2-createsecureserver-nooptions.js
Trivikram Kamat 0ce6be07da test: http2 ERR_INVALID_ARG_TYPE tests
PR-URL: https://github.com/nodejs/node/pull/15766
Ref: https://github.com/nodejs/node/issues/14985
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
2017-10-15 21:36:37 -07:00

23 lines
553 B
JavaScript

'use strict';
const common = require('../common');
if (!common.hasCrypto)
common.skip('missing crypto');
const http2 = require('http2');
const invalidOptions = [() => {}, 1, 'test', null, undefined];
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
)
);