Skip to content

Commit

Permalink
test: update test-http2-server-sessionerror.js
Browse files Browse the repository at this point in the history
  • Loading branch information
daeyeon committed Apr 28, 2022
1 parent d258697 commit f5120d0
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions test/parallel/test-http2-server-sessionerror.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,17 @@ const common = require('../common');
if (!common.hasCrypto)
common.skip('missing crypto');
const http2 = require('http2');
const assert = require('assert');
const { kSocket } = require('internal/http2/util');
const { ServerHttp2Session } = require('internal/http2/core');

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

let test = 0;

server.on('session', common.mustCall((session) => {
assert.strictEqual(session instanceof ServerHttp2Session, true);
switch (++test) {
case 1:
server.on('error', common.mustNotCall());
Expand All @@ -32,6 +35,12 @@ server.on('session', common.mustCall((session) => {
}
}, 2));

server.on('sessionError', common.mustCall((err, session) => {
assert.strictEqual(err.name, 'Error');
assert.strictEqual(err.message, 'test');
assert.strictEqual(session instanceof ServerHttp2Session, true);
}, 2));

server.listen(0, common.mustCall(() => {
const url = `http://localhost:${server.address().port}`;
http2.connect(url)
Expand Down

0 comments on commit f5120d0

Please sign in to comment.