Skip to content

Commit 4ba9b20

Browse files
committed
test: update test-http2-server-sessionerror.js
1 parent d258697 commit 4ba9b20

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

test/parallel/test-http2-server-sessionerror.js

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,17 @@ const common = require('../common');
66
if (!common.hasCrypto)
77
common.skip('missing crypto');
88
const http2 = require('http2');
9+
const assert = require('assert');
910
const { kSocket } = require('internal/http2/util');
11+
const { ServerHttp2Session } = require('internal/http2/core');
1012

1113
const server = http2.createServer();
1214
server.on('stream', common.mustNotCall());
1315

1416
let test = 0;
1517

1618
server.on('session', common.mustCall((session) => {
19+
assert.strictEqual(session instanceof ServerHttp2Session, true);
1720
switch (++test) {
1821
case 1:
1922
server.on('error', common.mustNotCall());
@@ -32,6 +35,12 @@ server.on('session', common.mustCall((session) => {
3235
}
3336
}, 2));
3437

38+
server.on('sessionError', common.mustCall((err, session) => {
39+
assert.strictEqual(err.name, 'Error');
40+
assert.strictEqual(err.message, 'test');
41+
assert.strictEqual(session instanceof ServerHttp2Session, true);
42+
}, 2));
43+
3544
server.listen(0, common.mustCall(() => {
3645
const url = `http://localhost:${server.address().port}`;
3746
http2.connect(url)

0 commit comments

Comments
 (0)