From 40ecf79377a10e0718a565662a4e58da76ad7cf3 Mon Sep 17 00:00:00 2001 From: Fabrice Tatieze Date: Tue, 27 Dec 2016 18:18:58 -0800 Subject: [PATCH 1/3] codeandlearn: use strictEqual instead of equal --- test/parallel/test-http-server.js | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/test/parallel/test-http-server.js b/test/parallel/test-http-server.js index 49283d621cecda..cb182eaf28aabb 100644 --- a/test/parallel/test-http-server.js +++ b/test/parallel/test-http-server.js @@ -16,23 +16,23 @@ var server = http.createServer(function(req, res) { req.id = request_number++; 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); + assert.strictEqual('GET', req.method); + assert.strictEqual('/hello', url.parse(req.url).pathname); + assert.strictEqual('world', qs.parse(url.parse(req.url).query).hello); + assert.strictEqual('b==ar', qs.parse(url.parse(req.url).query).foo); } if (req.id === 1) { - assert.equal('POST', req.method); - assert.equal('/quit', url.parse(req.url).pathname); + assert.strictEqual('POST', req.method); + assert.strictEqual('/quit', url.parse(req.url).pathname); } if (req.id === 2) { - assert.equal('foo', req.headers['x-x']); + assert.strictEqual('foo', req.headers['x-x']); } if (req.id === 3) { - assert.equal('bar', req.headers['x-x']); + assert.strictEqual('bar', req.headers['x-x']); this.close(); } @@ -75,7 +75,7 @@ server.on('listening', function() { // you set server.httpAllowHalfOpen=true, which we've done // above. c.end(); - assert.equal(c.readyState, 'readOnly'); + assert.strictEqual(c.readyState, 'readOnly'); requests_sent += 2; } @@ -86,19 +86,19 @@ server.on('listening', function() { }); c.on('close', function() { - assert.equal(c.readyState, 'closed'); + assert.strictEqual(c.readyState, 'closed'); }); }); process.on('exit', function() { - assert.equal(4, request_number); - assert.equal(4, requests_sent); + assert.strictEqual(4, request_number); + assert.strictEqual(4, requests_sent); var hello = new RegExp('/hello'); - assert.equal(true, hello.exec(server_response) != null); + assert.strictEqual(true, hello.exec(server_response) != null); var quit = new RegExp('/quit'); - assert.equal(true, quit.exec(server_response) != null); + assert.strictEqual(true, quit.exec(server_response) != null); - assert.equal(true, client_got_eof); + assert.strictEqual(true, client_got_eof); }); From 09451b0179024bf9425c5393a7333f7cb8f63d9b Mon Sep 17 00:00:00 2001 From: Fabrice Tatieze Date: Tue, 27 Dec 2016 20:30:37 -0800 Subject: [PATCH 2/3] codeandlearn: updating assertion to use notEqual. --- test/parallel/test-http-server.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-http-server.js b/test/parallel/test-http-server.js index cb182eaf28aabb..16b44bdfa3d68b 100644 --- a/test/parallel/test-http-server.js +++ b/test/parallel/test-http-server.js @@ -95,10 +95,10 @@ process.on('exit', function() { assert.strictEqual(4, requests_sent); var hello = new RegExp('/hello'); - assert.strictEqual(true, hello.exec(server_response) != null); + assert.notEqual(null, hello.exec(server_response)); var quit = new RegExp('/quit'); - assert.strictEqual(true, quit.exec(server_response) != null); + assert.notEqual(null, quit.exec(server_response)); assert.strictEqual(true, client_got_eof); }); From f316fb44043b33a21d5f2d805c41674f1ee05b98 Mon Sep 17 00:00:00 2001 From: Fabrice Tatieze Date: Wed, 28 Dec 2016 17:18:24 -0800 Subject: [PATCH 3/3] codeandlearn: using notStrictEqual. --- test/parallel/test-http-server.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/parallel/test-http-server.js b/test/parallel/test-http-server.js index 16b44bdfa3d68b..1870bcc7170726 100644 --- a/test/parallel/test-http-server.js +++ b/test/parallel/test-http-server.js @@ -95,10 +95,10 @@ process.on('exit', function() { assert.strictEqual(4, requests_sent); var hello = new RegExp('/hello'); - assert.notEqual(null, hello.exec(server_response)); + assert.notStrictEqual(null, hello.exec(server_response)); var quit = new RegExp('/quit'); - assert.notEqual(null, quit.exec(server_response)); + assert.notStrictEqual(null, quit.exec(server_response)); assert.strictEqual(true, client_got_eof); });