Skip to content

Commit

Permalink
test: add test to improve coverage in http2-compat-serverresponse
Browse files Browse the repository at this point in the history
  • Loading branch information
Cesar-M-Diaz committed Oct 11, 2022
1 parent 6686d90 commit 6fdebfc
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions test/parallel/test-http2-compat-serverresponse-write.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,3 +71,26 @@ const assert = require('assert');
}));
}));
}

{
const server = createServer();
server.listen(0, mustCall(() => {
const port = server.address().port;
const url = `http://localhost:${port}`;
const client = connect(url, mustCall(() => {
const request = client.request();
request.resume();
request.on('end', mustCall());
request.on('close', mustCall(() => {
client.close();
}));
}));

server.once('request', mustCall((request, response) => {
response.destroy();
assert.strictEqual(response.write('asd', mustNotCall()), false);
client.destroy();
server.close();
}));
}));
}

0 comments on commit 6fdebfc

Please sign in to comment.