diff --git a/test/parallel/test-http-agent.js b/test/parallel/test-http-agent.js index 075049d416..dae982ed51 100644 --- a/test/parallel/test-http-agent.js +++ b/test/parallel/test-http-agent.js @@ -19,7 +19,7 @@ server.listen(0, function() { for (var j = 0; j < M; j++) { http.get({ port: port, path: '/' }, function(res) { console.log('%d %d', responses, res.statusCode); - if (++responses == N * M) { + if (++responses === N * M) { console.error('Received all responses, closing server'); server.close(); } diff --git a/test/parallel/test-http-allow-req-after-204-res.js b/test/parallel/test-http-allow-req-after-204-res.js index 34d7c0bbda..1c94d81581 100644 --- a/test/parallel/test-http-allow-req-after-204-res.js +++ b/test/parallel/test-http-allow-req-after-204-res.js @@ -28,7 +28,7 @@ function nextRequest() { path: '/' }, function(response) { response.on('end', function() { - if (methods.length == 0) { + if (methods.length === 0) { console.error('close server'); server.close(); } else { diff --git a/test/parallel/test-http-client-abort.js b/test/parallel/test-http-client-abort.js index 73f05da577..c2e4d7a3a6 100644 --- a/test/parallel/test-http-client-abort.js +++ b/test/parallel/test-http-client-abort.js @@ -43,7 +43,7 @@ server.listen(0, function() { console.log('Client response code ' + res.statusCode); res.resume(); - if (++responses == N) { + if (++responses === N) { console.log('All clients connected, destroying.'); requests.forEach(function(outReq) { console.log('abort'); diff --git a/test/parallel/test-http-client-timeout-agent.js b/test/parallel/test-http-client-timeout-agent.js index c479f6ef1c..c741c6793d 100644 --- a/test/parallel/test-http-client-timeout-agent.js +++ b/test/parallel/test-http-client-timeout-agent.js @@ -71,6 +71,6 @@ server.listen(0, options.host, function() { process.on('exit', function() { console.error('done=%j sent=%j', requests_done, requests_sent); - assert.ok(requests_done == requests_sent, - 'timeout on http request called too much'); + assert.strictEqual(requests_done, requests_sent, + 'timeout on http request called too much'); }); diff --git a/test/parallel/test-http-exceptions.js b/test/parallel/test-http-exceptions.js index e82485c0b3..51f9664e38 100644 --- a/test/parallel/test-http-exceptions.js +++ b/test/parallel/test-http-exceptions.js @@ -20,6 +20,6 @@ var exception_count = 0; process.on('uncaughtException', function(err) { console.log('Caught an exception: ' + err); if (err.name === 'AssertionError') throw err; - if (++exception_count == 4) process.exit(0); + if (++exception_count === 4) process.exit(0); }); diff --git a/test/parallel/test-http-expect-continue.js b/test/parallel/test-http-expect-continue.js index a98cfcc07d..a0ebf83b33 100644 --- a/test/parallel/test-http-expect-continue.js +++ b/test/parallel/test-http-expect-continue.js @@ -58,7 +58,7 @@ server.on('listening', function() { assert.equal(body, test_res_body, 'Response body doesn\'t match.'); assert.ok('abcd' in res.headers, 'Response headers missing.'); outstanding_reqs--; - if (outstanding_reqs == 0) { + if (outstanding_reqs === 0) { server.close(); process.exit(); } diff --git a/test/parallel/test-http-get-pipeline-problem.js b/test/parallel/test-http-get-pipeline-problem.js index 9f2287e299..cc681f675a 100644 --- a/test/parallel/test-http-get-pipeline-problem.js +++ b/test/parallel/test-http-get-pipeline-problem.js @@ -19,7 +19,7 @@ var total = 10; var requests = 0, responses = 0; var server = http.Server(function(req, res) { - if (++requests == total) { + if (++requests === total) { server.close(); } @@ -51,7 +51,7 @@ server.listen(0, function() { s.on('finish', function() { console.error('done ' + x); - if (++responses == total) { + if (++responses === total) { checkFiles(); } }); diff --git a/test/parallel/test-http-incoming-pipelined-socket-destroy.js b/test/parallel/test-http-incoming-pipelined-socket-destroy.js index 0cb29610f1..9789e9976c 100644 --- a/test/parallel/test-http-incoming-pipelined-socket-destroy.js +++ b/test/parallel/test-http-incoming-pipelined-socket-destroy.js @@ -52,7 +52,7 @@ server.listen(0, function() { var client = net.connect({ port: this.address().port }); var done = 0; server.on('requestDone', function() { - if (++done == seeds.length) { + if (++done === seeds.length) { server.close(); } }); diff --git a/test/parallel/test-http-legacy.js b/test/parallel/test-http-legacy.js index 363c3a9236..334da53c57 100644 --- a/test/parallel/test-http-legacy.js +++ b/test/parallel/test-http-legacy.js @@ -10,7 +10,7 @@ var body0 = ''; var body1 = ''; var server = http.createServer(function(req, res) { - if (responses_sent == 0) { + if (responses_sent === 0) { assert.equal('GET', req.method); assert.equal('/hello', url.parse(req.url).pathname); @@ -22,7 +22,7 @@ var server = http.createServer(function(req, res) { assert.equal('bar', req.headers['foo']); } - if (responses_sent == 1) { + if (responses_sent === 1) { assert.equal('POST', req.method); assert.equal('/world', url.parse(req.url).pathname); this.close(); diff --git a/test/parallel/test-http-malformed-request.js b/test/parallel/test-http-malformed-request.js index fe6c01b79d..647b67bcd3 100644 --- a/test/parallel/test-http-malformed-request.js +++ b/test/parallel/test-http-malformed-request.js @@ -18,7 +18,7 @@ var server = http.createServer(function(req, res) { res.write('Hello World'); res.end(); - if (++nrequests_completed == nrequests_expected) server.close(); + if (++nrequests_completed === nrequests_expected) server.close(); }); server.listen(0); diff --git a/test/parallel/test-http-server.js b/test/parallel/test-http-server.js index 110a1ebca9..49283d621c 100644 --- a/test/parallel/test-http-server.js +++ b/test/parallel/test-http-server.js @@ -15,23 +15,23 @@ var server = http.createServer(function(req, res) { res.id = request_number; req.id = request_number++; - if (req.id == 0) { + if (req.id === 0) { assert.equal('GET', req.method); assert.equal('/hello', url.parse(req.url).pathname); assert.equal('world', qs.parse(url.parse(req.url).query).hello); assert.equal('b==ar', qs.parse(url.parse(req.url).query).foo); } - if (req.id == 1) { + if (req.id === 1) { assert.equal('POST', req.method); assert.equal('/quit', url.parse(req.url).pathname); } - if (req.id == 2) { + if (req.id === 2) { assert.equal('foo', req.headers['x-x']); } - if (req.id == 3) { + if (req.id === 3) { assert.equal('bar', req.headers['x-x']); this.close(); } @@ -60,12 +60,12 @@ server.on('listening', function() { c.on('data', function(chunk) { server_response += chunk; - if (requests_sent == 1) { + if (requests_sent === 1) { c.write('POST /quit HTTP/1.1\r\n\r\n'); requests_sent += 1; } - if (requests_sent == 2) { + if (requests_sent === 2) { c.write('GET / HTTP/1.1\r\nX-X: foo\r\n\r\n' + 'GET / HTTP/1.1\r\nX-X: bar\r\n\r\n'); // Note: we are making the connection half-closed here diff --git a/test/parallel/test-http-set-cookies.js b/test/parallel/test-http-set-cookies.js index 522119c958..9b0210828c 100644 --- a/test/parallel/test-http-set-cookies.js +++ b/test/parallel/test-http-set-cookies.js @@ -6,7 +6,7 @@ var http = require('http'); var nresponses = 0; var server = http.createServer(function(req, res) { - if (req.url == '/one') { + if (req.url === '/one') { res.writeHead(200, [['set-cookie', 'A'], ['content-type', 'text/plain']]); res.end('one\n'); @@ -34,7 +34,7 @@ server.on('listening', function() { }); res.on('end', function() { - if (++nresponses == 2) { + if (++nresponses === 2) { server.close(); } }); @@ -51,7 +51,7 @@ server.on('listening', function() { }); res.on('end', function() { - if (++nresponses == 2) { + if (++nresponses === 2) { server.close(); } }); diff --git a/test/parallel/test-http-set-trailers.js b/test/parallel/test-http-set-trailers.js index df69a060c8..b3f331c6d8 100644 --- a/test/parallel/test-http-set-trailers.js +++ b/test/parallel/test-http-set-trailers.js @@ -35,7 +35,7 @@ server.on('listening', function() { c.end(); assert.ok(!/x-foo/.test(res_buffer), 'Trailer in HTTP/1.0 response.'); outstanding_reqs--; - if (outstanding_reqs == 0) { + if (outstanding_reqs === 0) { server.close(); process.exit(); } @@ -66,7 +66,7 @@ server.on('listening', function() { /0\r\nx-foo: bar\r\n\r\n$/.test(res_buffer), 'No trailer in HTTP/1.1 response.' ); - if (outstanding_reqs == 0) { + if (outstanding_reqs === 0) { server.close(); process.exit(); } @@ -85,7 +85,7 @@ server.on('listening', function() { //console.log(res.trailers); assert.ok('x-foo' in res.trailers, 'Client doesn\'t see trailers.'); outstanding_reqs--; - if (outstanding_reqs == 0) { + if (outstanding_reqs === 0) { server.close(); process.exit(); } diff --git a/test/parallel/test-http-timeout.js b/test/parallel/test-http-timeout.js index d1cec8e6e0..b8a28fc2c4 100644 --- a/test/parallel/test-http-timeout.js +++ b/test/parallel/test-http-timeout.js @@ -29,7 +29,7 @@ server.listen(0, function() { res.on('end', function() { count++; - if (count == 11) { + if (count === 11) { server.close(); } }); diff --git a/test/parallel/test-http-upgrade-server.js b/test/parallel/test-http-upgrade-server.js index ba0533c0fe..8570dec899 100644 --- a/test/parallel/test-http-upgrade-server.js +++ b/test/parallel/test-http-upgrade-server.js @@ -38,7 +38,7 @@ function testServer() { socket.on('data', function(d) { var data = d.toString('utf8'); - if (data == 'kill') { + if (data === 'kill') { socket.end(); } else { socket.write(data, 'utf8'); @@ -78,11 +78,11 @@ function test_upgrade_with_listener() { assert.equal('string', typeof data); - if (state == 1) { + if (state === 1) { assert.equal('HTTP/1.1 101', data.substr(0, 12)); assert.equal('WjN}|M(6', request_upgradeHead.toString('utf8')); conn.write('test', 'utf8'); - } else if (state == 2) { + } else if (state === 2) { assert.equal('test', data); conn.write('kill', 'utf8'); } diff --git a/test/pummel/test-http-upload-timeout.js b/test/pummel/test-http-upload-timeout.js index 6e5a7ed050..15bc267ff6 100644 --- a/test/pummel/test-http-upload-timeout.js +++ b/test/pummel/test-http-upload-timeout.js @@ -16,7 +16,7 @@ server.on('request', function(req, res) { connections--; res.writeHead(200); res.end('done\n'); - if (connections == 0) { + if (connections === 0) { server.close(); } });