From 8d193919fbfe0bb472ccd3f07e852d9f281cecd8 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 3fb647399d6e3d..1a3c099d4df897 100644 --- a/test/parallel/test-http-client-agent.js +++ b/test/parallel/test-http-client-agent.js @@ -55,7 +55,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 96f3119c3be9ab..05dd509e19e6af 100644 --- a/test/parallel/test-http-client-default-headers-exist.js +++ b/test/parallel/test-http-client-default-headers-exist.js @@ -46,9 +46,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}` ); });