diff options
author | Trivikram Kamat <trivikr.dev@gmail.com> | 2017-10-03 20:16:05 -0700 |
---|---|---|
committer | James M Snell <jasnell@gmail.com> | 2017-10-15 21:36:37 -0700 |
commit | 0ce6be07dadc3e8b3d761d1e3128c68a5f70ed0a (patch) | |
tree | 15119cfe910d65f25ed1bc17704f3718fd9a7884 /test/parallel/test-http2-createsecureserver-nooptions.js | |
parent | 006fdb2fe5d9d1681f25c44009242304740ce154 (diff) | |
download | node-new-0ce6be07dadc3e8b3d761d1e3128c68a5f70ed0a.tar.gz |
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>
Diffstat (limited to 'test/parallel/test-http2-createsecureserver-nooptions.js')
-rw-r--r-- | test/parallel/test-http2-createsecureserver-nooptions.js | 48 |
1 files changed, 13 insertions, 35 deletions
diff --git a/test/parallel/test-http2-createsecureserver-nooptions.js b/test/parallel/test-http2-createsecureserver-nooptions.js index 652a281506..05029cba2b 100644 --- a/test/parallel/test-http2-createsecureserver-nooptions.js +++ b/test/parallel/test-http2-createsecureserver-nooptions.js @@ -6,39 +6,17 @@ if (!common.hasCrypto) const http2 = require('http2'); -// Error if options are not passed to createSecureServer - -common.expectsError( - () => http2.createSecureServer(), - { - code: 'ERR_INVALID_ARG_TYPE', - type: TypeError - }); - -common.expectsError( - () => http2.createSecureServer(() => {}), - { - code: 'ERR_INVALID_ARG_TYPE', - type: TypeError - }); +const invalidOptions = [() => {}, 1, 'test', null, undefined]; +const invalidArgTypeError = { + type: TypeError, + code: 'ERR_INVALID_ARG_TYPE', + message: 'The "options" argument must be of type object' +}; -common.expectsError( - () => http2.createSecureServer(1), - { - code: 'ERR_INVALID_ARG_TYPE', - type: TypeError - }); - -common.expectsError( - () => http2.createSecureServer('test'), - { - code: 'ERR_INVALID_ARG_TYPE', - type: TypeError - }); - -common.expectsError( - () => http2.createSecureServer(null), - { - code: 'ERR_INVALID_ARG_TYPE', - type: TypeError - }); +// Error if options are not passed to createSecureServer +invalidOptions.forEach((invalidOption) => + common.expectsError( + () => http2.createSecureServer(invalidOption), + invalidArgTypeError + ) +); |