Browse Source

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 <luigipinca@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
v6
Aditya Anand 8 years ago
committed by Refael Ackermann
parent
commit
9c6427864e
  1. 3
      test/parallel/test-http-client-agent.js
  2. 6
      test/parallel/test-http-client-default-headers-exist.js

3
test/parallel/test-http-client-agent.js

@ -55,7 +55,8 @@ function request(i) {
socket.on('close', function() { socket.on('close', function() {
++count; ++count;
if (count < max) { if (count < max) {
assert.strictEqual(http.globalAgent.sockets[name].indexOf(socket), -1); assert.strictEqual(http.globalAgent.sockets[name].includes(socket),
false);
} else { } else {
assert(!http.globalAgent.sockets.hasOwnProperty(name)); assert(!http.globalAgent.sockets.hasOwnProperty(name));
assert(!http.globalAgent.requests.hasOwnProperty(name)); assert(!http.globalAgent.requests.hasOwnProperty(name));

6
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); const requestHeaders = Object.keys(req.headers);
requestHeaders.forEach(function(header) { requestHeaders.forEach(function(header) {
assert.notStrictEqual( assert.strictEqual(
expectedHeaders[req.method].indexOf(header.toLowerCase()), expectedHeaders[req.method].includes(header.toLowerCase()),
-1, true,
`${header} should not exist for method ${req.method}` `${header} should not exist for method ${req.method}`
); );
}); });

Loading…
Cancel
Save