diff --git a/test/parallel/test-http-agent.js b/test/parallel/test-http-agent.js index 075049d416f6aa..dae982ed51a302 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 34d7c0bbdabca6..1c94d815811388 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 cd009a152aa547..4f46128f0e804a 100644 --- a/test/parallel/test-http-client-abort.js +++ b/test/parallel/test-http-client-abort.js @@ -37,7 +37,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 c479f6ef1c718b..c741c6793d2e49 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 e82485c0b30996..51f9664e381e38 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 a98cfcc07d05af..a0ebf83b3301a5 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 9f2287e2990b3f..cc681f675a791e 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 0cb29610f1b6d2..9789e9976cb7a7 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 36165954cb8f8f..165e51ff418ed0 100644 --- a/test/parallel/test-http-legacy.js +++ b/test/parallel/test-http-legacy.js @@ -9,7 +9,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); @@ -21,7 +21,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 fe6c01b79ddd66..647b67bcd3ff78 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-response-multiheaders.js b/test/parallel/test-http-response-multiheaders.js index cde9867538d623..577f401abb60ab 100644 --- a/test/parallel/test-http-response-multiheaders.js +++ b/test/parallel/test-http-response-multiheaders.js @@ -30,12 +30,12 @@ const norepeat = [ const server = http.createServer(function(req, res) { var num = req.headers['x-num']; - if (num == 1) { + if (num === '1') { for (const name of norepeat) { res.setHeader(name, ['A', 'B']); } res.setHeader('X-A', ['A', 'B']); - } else if (num == 2) { + } else if (num === '2') { const headers = {}; for (const name of norepeat) { headers[name] = ['A', 'B']; diff --git a/test/parallel/test-http-server.js b/test/parallel/test-http-server.js index 110a1ebca93247..49283d621cecda 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 8707267dda0306..1f00ebb65e34de 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 df69a060c8d052..b3f331c6d8b172 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 d1cec8e6e0c324..b8a28fc2c4cf32 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 ba0533c0fe8293..8570dec899b672 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 6e5a7ed0506ffd..15bc267ff61947 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(); } });