test: replace indexOf with includes

Start the transition to Array.prototype.includes() and
String.prototype.includes().  This commit refactors most of the
comparisons of Array.prototype.indexOf() and String.prototype.indexOf()
return values with -1 to the former methods in tests.

PR-URL: https://github.com/nodejs/node/pull/12604
Refs: https://github.com/nodejs/node/issues/12586
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
This commit is contained in:
gwer authored and Myles Borins committed 2017-07-11 17:43:44 +01:00
1 parent 03adb94ee6
commit 54decfa2ce
21 files changed
+67 -67

No files matched your search

+3 -3
View File
@@ -111,11 +111,11 @@ function makeReq(path, port, error, host, ca) {
options.agent = agent0;
} else {
if (!Array.isArray(ca)) ca = [ca];
if (-1 !== ca.indexOf(ca1) && -1 !== ca.indexOf(ca2)) {
if (ca.includes(ca1) && ca.includes(ca2)) {
options.agent = agent3;
} else if (-1 !== ca.indexOf(ca1)) {
} else if (ca.includes(ca1)) {
options.agent = agent1;
} else if (-1 !== ca.indexOf(ca2)) {
} else if (ca.includes(ca2)) {
options.agent = agent2;
} else {
options.agent = agent0;