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-invalidargtypes-errors.js | |
parent | 006fdb2fe5d9d1681f25c44009242304740ce154 (diff) | |
download | android-node-v8-0ce6be07dadc3e8b3d761d1e3128c68a5f70ed0a.tar.gz android-node-v8-0ce6be07dadc3e8b3d761d1e3128c68a5f70ed0a.tar.bz2 android-node-v8-0ce6be07dadc3e8b3d761d1e3128c68a5f70ed0a.zip |
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-invalidargtypes-errors.js')
-rw-r--r-- | test/parallel/test-http2-invalidargtypes-errors.js | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/test/parallel/test-http2-invalidargtypes-errors.js b/test/parallel/test-http2-invalidargtypes-errors.js new file mode 100644 index 0000000000..93d161557c --- /dev/null +++ b/test/parallel/test-http2-invalidargtypes-errors.js @@ -0,0 +1,43 @@ +'use strict'; + +const common = require('../common'); +if (!common.hasCrypto) + common.skip('missing crypto'); +const http2 = require('http2'); + +const server = http2.createServer(); + +server.on( + 'stream', + common.mustCall((stream) => { + const invalidArgTypeError = (param, type) => ({ + type: TypeError, + code: 'ERR_INVALID_ARG_TYPE', + message: `The "${param}" argument must be of type ${type}` + }); + common.expectsError( + () => stream.session.priority(undefined, {}), + invalidArgTypeError('stream', 'Http2Stream') + ); + common.expectsError( + () => stream.session.rstStream(undefined), + invalidArgTypeError('stream', 'Http2Stream') + ); + common.expectsError( + () => stream.session.rstStream(stream, 'string'), + invalidArgTypeError('code', 'number') + ); + stream.session.destroy(); + }) +); + +server.listen( + 0, + common.mustCall(() => { + const client = http2.connect(`http://localhost:${server.address().port}`); + const req = client.request(); + req.resume(); + req.on('end', common.mustCall(() => server.close())); + req.end(); + }) +); |