diff options
Diffstat (limited to 'test/parallel/test-http2-createserver-options.js')
-rw-r--r-- | test/parallel/test-http2-createserver-options.js | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/test/parallel/test-http2-createserver-options.js b/test/parallel/test-http2-createserver-options.js index d322506f55..47504a8a77 100644 --- a/test/parallel/test-http2-createserver-options.js +++ b/test/parallel/test-http2-createserver-options.js @@ -7,7 +7,7 @@ if (!common.hasCrypto) const assert = require('assert'); const http2 = require('http2'); -// Error if invalid options are passed to createServer +// Error if invalid options are passed to createServer. const invalidOptions = [1, true, 'test', null, Symbol('test')]; invalidOptions.forEach((invalidOption) => { assert.throws( @@ -21,7 +21,7 @@ invalidOptions.forEach((invalidOption) => { ); }); -// Error if invalid options.settings are passed to createServer +// Error if invalid options.settings are passed to createServer. invalidOptions.forEach((invalidSettingsOption) => { assert.throws( () => http2.createServer({ settings: invalidSettingsOption }), @@ -33,3 +33,30 @@ invalidOptions.forEach((invalidSettingsOption) => { } ); }); + +// Test that http2.createServer validates input options. +Object.entries({ + maxSessionInvalidFrames: [ + { + val: -1, + err: { + name: 'RangeError', + code: 'ERR_OUT_OF_RANGE', + }, + }, + { + val: Number.NEGATIVE_INFINITY, + err: { + name: 'RangeError', + code: 'ERR_OUT_OF_RANGE', + }, + }, + ], +}).forEach(([opt, tests]) => { + tests.forEach(({ val, err }) => { + assert.throws( + () => http2.createServer({ [opt]: val }), + err + ); + }); +}); |