diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/parallel/test-http-req-res-close.js | 15 |
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()); })); |