From bc156daf605768d0af46e67ae102f9520e0010b1 Mon Sep 17 00:00:00 2001 From: Trivikram <16024985+trivikr@users.noreply.github.com> Date: Sat, 17 Feb 2018 23:47:24 -0800 Subject: [PATCH] test: http2 client settings invalid callback PR-URL: https://github.com/nodejs/node/pull/18850 Reviewed-By: Ruben Bridgewater Reviewed-By: James M Snell Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca --- ...st-http2-client-settings-before-connect.js | 21 +++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-http2-client-settings-before-connect.js b/test/parallel/test-http2-client-settings-before-connect.js index 4642bf5220f554..ceea1bc39ad7d3 100644 --- a/test/parallel/test-http2-client-settings-before-connect.js +++ b/test/parallel/test-http2-client-settings-before-connect.js @@ -35,13 +35,26 @@ server.listen(0, common.mustCall(() => { ['enablePush', 0, TypeError], ['enablePush', null, TypeError], ['enablePush', {}, TypeError] - ].forEach((i) => { + ].forEach(([name, value, errorType]) => common.expectsError( - () => client.settings({ [i[0]]: i[1] }), + () => client.settings({ [name]: value }), { code: 'ERR_HTTP2_INVALID_SETTING_VALUE', - type: i[2] }); - }); + type: errorType + } + ) + ); + + [1, true, {}, []].forEach((invalidCallback) => + common.expectsError( + () => client.settings({}, invalidCallback), + { + type: TypeError, + code: 'ERR_INVALID_CALLBACK', + message: 'Callback must be a function' + } + ) + ); client.settings({ maxFrameSize: 1234567 });