From b793fc6cf66710cd2735683ec8cda28145378dc0 Mon Sep 17 00:00:00 2001 From: Aditya Anand Date: Thu, 25 May 2017 17:32:47 +0530 Subject: [PATCH] test: replace `indexOf` with `includes` PR-URL: https://github.com/nodejs/node/pull/13215 Refs: https://github.com/nodejs/node/issues/12586 Reviewed-By: Luigi Pinca Reviewed-By: Colin Ihrig Reviewed-By: Refael Ackermann Reviewed-By: James M Snell Reviewed-By: Gibson Fahnestock --- test/parallel/test-http-client-agent.js | 3 ++- test/parallel/test-http-client-default-headers-exist.js | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/test/parallel/test-http-client-agent.js b/test/parallel/test-http-client-agent.js index b90694523745d4..6d30a2236ef485 100644 --- a/test/parallel/test-http-client-agent.js +++ b/test/parallel/test-http-client-agent.js @@ -34,7 +34,8 @@ function request(i) { socket.on('close', function() { ++count; if (count < max) { - assert.strictEqual(http.globalAgent.sockets[name].indexOf(socket), -1); + assert.strictEqual(http.globalAgent.sockets[name].includes(socket), + false); } else { assert(!http.globalAgent.sockets.hasOwnProperty(name)); assert(!http.globalAgent.requests.hasOwnProperty(name)); diff --git a/test/parallel/test-http-client-default-headers-exist.js b/test/parallel/test-http-client-default-headers-exist.js index 06923b6c79c5c0..410f83449fc1b6 100644 --- a/test/parallel/test-http-client-default-headers-exist.js +++ b/test/parallel/test-http-client-default-headers-exist.js @@ -25,9 +25,9 @@ const server = http.createServer(function(req, res) { const requestHeaders = Object.keys(req.headers); requestHeaders.forEach(function(header) { - assert.notStrictEqual( - expectedHeaders[req.method].indexOf(header.toLowerCase()), - -1, + assert.strictEqual( + expectedHeaders[req.method].includes(header.toLowerCase()), + true, `${header} should not exist for method ${req.method}` ); });