Skip to content

Commit 68edce2

Browse files
committed
fix: add test case for invalid useH2c param
1 parent 734619e commit 68edce2

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

test/h2c-client.js

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ const { test } = require('node:test')
77
const { tspl } = require('@matteo.collina/tspl')
88
const pem = require('@metcoder95/https-pem')
99

10-
const { H2CClient } = require('..')
10+
const { H2CClient, Client } = require('..')
1111

1212
test('Should throw if no h2c origin', async t => {
1313
const planner = tspl(t, { plan: 1 })
@@ -139,3 +139,18 @@ test('Connect to h2c server over a unix domain socket', { skip: process.platform
139139
server.close()
140140
})
141141
})
142+
143+
test('Should throw if bad useH2c has been passed', async t => {
144+
t = tspl(t, { plan: 1 })
145+
146+
t.throws(() => {
147+
// eslint-disable-next-line
148+
new Client('https://localhost:1000', {
149+
useH2c: 'true'
150+
})
151+
}, {
152+
message: 'useH2c must be a valid boolean value'
153+
})
154+
155+
await t.completed
156+
})

0 commit comments

Comments
 (0)