Skip to content

Commit

Permalink
refactor http.get expectedCount with common.mustCall
Browse files Browse the repository at this point in the history
  • Loading branch information
weewey committed Apr 27, 2017
1 parent 1d96803 commit 6306067
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions test/parallel/test-https-strict.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,7 @@ function makeReq(path, port, error, host, ca) {
if (!server) throw new Error('invalid port: ' + port);
server.expectCount++;

req.on('response', (res) => {
responseCount++;
req.on('response', common.mustCall((res) => {
assert.strictEqual(res.connection.authorizationError, error);
responseErrors[path] = res.connection.authorizationError;
pending--;
Expand All @@ -167,7 +166,7 @@ function makeReq(path, port, error, host, ca) {
server3.close();
}
res.resume();
});
}));
}

function allListening() {
Expand Down Expand Up @@ -220,5 +219,4 @@ process.on('exit', () => {
assert.strictEqual(server1.requests.length, server1.expectCount);
assert.strictEqual(server2.requests.length, server2.expectCount);
assert.strictEqual(server3.requests.length, server3.expectCount);
assert.strictEqual(responseCount, expectResponseCount);
});

0 comments on commit 6306067

Please sign in to comment.