Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'test/parallel/test-http-req-res-close.js')
-rw-r--r--test/parallel/test-http-req-res-close.js15
1 files changed, 12 insertions, 3 deletions
diff --git a/test/parallel/test-http-req-res-close.js b/test/parallel/test-http-req-res-close.js
index 240134cb5d0..daba55f4342 100644
--- a/test/parallel/test-http-req-res-close.js
+++ b/test/parallel/test-http-req-res-close.js
@@ -2,12 +2,21 @@
const common = require('../common');
const http = require('http');
+const assert = require('assert');
const server = http.Server(common.mustCall((req, res) => {
+ let resClosed = false;
+
res.end();
- res.on('finish', common.mustCall());
- res.on('close', common.mustCall());
- req.on('close', common.mustCall());
+ res.on('finish', common.mustCall(() => {
+ assert.strictEqual(resClosed, false);
+ }));
+ res.on('close', common.mustCall(() => {
+ resClosed = true;
+ }));
+ req.on('close', common.mustCall(() => {
+ assert.strictEqual(req._readableState.ended, true);
+ }));
res.socket.on('close', () => server.close());
}));