Skip to content

Commit 10f92d1

Browse files
trivikrMylesBorins
authored andcommitted
test: http2 client settings invalid callback
PR-URL: #18850 Reviewed-By: Ruben Bridgewater <[email protected]> Reviewed-By: James M Snell <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]>
1 parent baf1acc commit 10f92d1

File tree

1 file changed

+17
-4
lines changed

1 file changed

+17
-4
lines changed

test/parallel/test-http2-client-settings-before-connect.js

+17-4
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,26 @@ server.listen(0, common.mustCall(() => {
3535
['enablePush', 0, TypeError],
3636
['enablePush', null, TypeError],
3737
['enablePush', {}, TypeError]
38-
].forEach((i) => {
38+
].forEach(([name, value, errorType]) =>
3939
common.expectsError(
40-
() => client.settings({ [i[0]]: i[1] }),
40+
() => client.settings({ [name]: value }),
4141
{
4242
code: 'ERR_HTTP2_INVALID_SETTING_VALUE',
43-
type: i[2] });
44-
});
43+
type: errorType
44+
}
45+
)
46+
);
47+
48+
[1, true, {}, []].forEach((invalidCallback) =>
49+
common.expectsError(
50+
() => client.settings({}, invalidCallback),
51+
{
52+
type: TypeError,
53+
code: 'ERR_INVALID_CALLBACK',
54+
message: 'Callback must be a function'
55+
}
56+
)
57+
);
4558

4659
client.settings({ maxFrameSize: 1234567 });
4760

0 commit comments

Comments
 (0)