Skip to content

Commit

Permalink
test: http2Stream redundant shutdown and single cb
Browse files Browse the repository at this point in the history
PR-URL: nodejs/node#15612
Refs: nodejs/node#14985
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Yuta Hiroto <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
  • Loading branch information
trivikr authored and addaleax committed Oct 4, 2017
1 parent b94c3fe commit b9cfd88
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions test/parallel/test-http2-server-shutdown-redundant.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
'use strict';

const common = require('../common');
if (!common.hasCrypto)
common.skip('missing crypto');
const assert = require('assert');
const http2 = require('http2');

const server = http2.createServer();

// Test blank return when a stream.session.shutdown is called twice
// Also tests stream.session.shutdown with just a callback function (no options)
server.on('stream', common.mustCall((stream) => {
stream.session.shutdown(common.mustCall(() => {
assert.strictEqual(
stream.session.shutdown(common.mustNotCall()),
undefined
);
}));
stream.session.shutdown(common.mustNotCall());
}));

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

const req = client.request();
req.resume();
req.on('end', common.mustCall(() => server.close()));
}));

0 comments on commit b9cfd88

Please sign in to comment.