Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 6abbe17

Browse filesBrowse files
Trottevanlucas
authored andcommitted
test: favor strict equality in http tests
PR-URL: #8151 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: jasnell - James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
1 parent cc9bb34 commit 6abbe17
Copy full SHA for 6abbe17
Expand file treeCollapse file tree

17 files changed

+32
-32
lines changed
Open diff view settings
Collapse file

‎test/parallel/test-http-agent.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http-agent.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ server.listen(0, function() {
1919
for (var j = 0; j < M; j++) {
2020
http.get({ port: port, path: '/' }, function(res) {
2121
console.log('%d %d', responses, res.statusCode);
22-
if (++responses == N * M) {
22+
if (++responses === N * M) {
2323
console.error('Received all responses, closing server');
2424
server.close();
2525
}
Collapse file

‎test/parallel/test-http-allow-req-after-204-res.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http-allow-req-after-204-res.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ function nextRequest() {
2828
path: '/'
2929
}, function(response) {
3030
response.on('end', function() {
31-
if (methods.length == 0) {
31+
if (methods.length === 0) {
3232
console.error('close server');
3333
server.close();
3434
} else {
Collapse file

‎test/parallel/test-http-client-abort.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http-client-abort.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ server.listen(0, function() {
3737
console.log('Client response code ' + res.statusCode);
3838

3939
res.resume();
40-
if (++responses == N) {
40+
if (++responses === N) {
4141
console.log('All clients connected, destroying.');
4242
requests.forEach(function(outReq) {
4343
console.log('abort');
Collapse file

‎test/parallel/test-http-client-timeout-agent.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http-client-timeout-agent.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,6 @@ server.listen(0, options.host, function() {
7171

7272
process.on('exit', function() {
7373
console.error('done=%j sent=%j', requests_done, requests_sent);
74-
assert.ok(requests_done == requests_sent,
75-
'timeout on http request called too much');
74+
assert.strictEqual(requests_done, requests_sent,
75+
'timeout on http request called too much');
7676
});
Collapse file

‎test/parallel/test-http-exceptions.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http-exceptions.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,6 @@ var exception_count = 0;
2020
process.on('uncaughtException', function(err) {
2121
console.log('Caught an exception: ' + err);
2222
if (err.name === 'AssertionError') throw err;
23-
if (++exception_count == 4) process.exit(0);
23+
if (++exception_count === 4) process.exit(0);
2424
});
2525

Collapse file

‎test/parallel/test-http-expect-continue.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http-expect-continue.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ server.on('listening', function() {
5858
assert.equal(body, test_res_body, 'Response body doesn\'t match.');
5959
assert.ok('abcd' in res.headers, 'Response headers missing.');
6060
outstanding_reqs--;
61-
if (outstanding_reqs == 0) {
61+
if (outstanding_reqs === 0) {
6262
server.close();
6363
process.exit();
6464
}
Collapse file

‎test/parallel/test-http-get-pipeline-problem.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http-get-pipeline-problem.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ var total = 10;
1919
var requests = 0, responses = 0;
2020

2121
var server = http.Server(function(req, res) {
22-
if (++requests == total) {
22+
if (++requests === total) {
2323
server.close();
2424
}
2525

@@ -51,7 +51,7 @@ server.listen(0, function() {
5151

5252
s.on('finish', function() {
5353
console.error('done ' + x);
54-
if (++responses == total) {
54+
if (++responses === total) {
5555
checkFiles();
5656
}
5757
});
Collapse file

‎test/parallel/test-http-incoming-pipelined-socket-destroy.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http-incoming-pipelined-socket-destroy.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ server.listen(0, function() {
5252
var client = net.connect({ port: this.address().port });
5353
var done = 0;
5454
server.on('requestDone', function() {
55-
if (++done == seeds.length) {
55+
if (++done === seeds.length) {
5656
server.close();
5757
}
5858
});
Collapse file

‎test/parallel/test-http-legacy.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http-legacy.js
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ var body0 = '';
99
var body1 = '';
1010

1111
var server = http.createServer(function(req, res) {
12-
if (responses_sent == 0) {
12+
if (responses_sent === 0) {
1313
assert.equal('GET', req.method);
1414
assert.equal('/hello', url.parse(req.url).pathname);
1515

@@ -21,7 +21,7 @@ var server = http.createServer(function(req, res) {
2121
assert.equal('bar', req.headers['foo']);
2222
}
2323

24-
if (responses_sent == 1) {
24+
if (responses_sent === 1) {
2525
assert.equal('POST', req.method);
2626
assert.equal('/world', url.parse(req.url).pathname);
2727
this.close();
Collapse file

‎test/parallel/test-http-malformed-request.js‎

Copy file name to clipboardExpand all lines: test/parallel/test-http-malformed-request.js
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ var server = http.createServer(function(req, res) {
1818
res.write('Hello World');
1919
res.end();
2020

21-
if (++nrequests_completed == nrequests_expected) server.close();
21+
if (++nrequests_completed === nrequests_expected) server.close();
2222
});
2323
server.listen(0);
2424

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.