Skip to content

Commit

Permalink
test: update http test to use common.mustCall
Browse files Browse the repository at this point in the history
PR-URL: #17528
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
  • Loading branch information
collin5 authored and gibfahn committed Dec 20, 2017
1 parent 9c93b97 commit 32adb70
Showing 1 changed file with 5 additions and 17 deletions.
22 changes: 5 additions & 17 deletions test/parallel/test-http-timeout-overflow.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,13 @@
// USE OR OTHER DEALINGS IN THE SOFTWARE.

'use strict';
require('../common');
const assert = require('assert');

const common = require('../common');
const http = require('http');

let serverRequests = 0;
let clientRequests = 0;

const server = http.createServer(function(req, res) {
serverRequests++;
const server = http.createServer(common.mustCall(function(req, res) {
res.writeHead(200, { 'Content-Type': 'text/plain' });
res.end('OK');
});
}));

server.listen(0, function() {
function callback() {}
Expand All @@ -44,10 +38,9 @@ server.listen(0, function() {
}, function(res) {
req.clearTimeout(callback);

res.on('end', function() {
clientRequests++;
res.on('end', common.mustCall(function() {
server.close();
});
}));

res.resume();
});
Expand All @@ -56,8 +49,3 @@ server.listen(0, function() {
req.setTimeout(0xffffffff, callback);
req.end();
});

process.once('exit', function() {
assert.strictEqual(clientRequests, 1);
assert.strictEqual(serverRequests, 1);
});

0 comments on commit 32adb70

Please sign in to comment.