Browse Source

test: replace indexOf with includes

Refs: https://github.com/nodejs/node/issues/12586
PR-URL: https://github.com/nodejs/node/pull/14630
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Vse Mozhet Byt <vsemozhetbyt@gmail.com>
Reviewed-By: Tobias Nießen <tniessen@tnie.de>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Yuta Hiroto <hello@about-hiroppy.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Alexey Orlenko <eaglexrlnk@gmail.com>
v6
Miguel Angel Asencio Hurtado 8 years ago
committed by James M Snell
parent
commit
9564c20810
  1. 4
      test/async-hooks/init-hooks.js
  2. 2
      test/parallel/test-repl-tab-complete.js

4
test/async-hooks/init-hooks.js

@ -67,7 +67,7 @@ class ActivityCollector {
const violations = []; const violations = [];
function v(msg) { violations.push(msg); } function v(msg) { violations.push(msg); }
for (const a of this._activities.values()) { for (const a of this._activities.values()) {
if (types != null && types.indexOf(a.type) < 0) continue; if (types != null && !types.includes(a.type)) continue;
if (a.init && a.init.length > 1) { if (a.init && a.init.length > 1) {
v('Activity inited twice\n' + activityString(a) + v('Activity inited twice\n' + activityString(a) +
@ -131,7 +131,7 @@ class ActivityCollector {
activitiesOfTypes(types) { activitiesOfTypes(types) {
if (!Array.isArray(types)) types = [ types ]; if (!Array.isArray(types)) types = [ types ];
return this.activities.filter((x) => types.indexOf(x.type) >= 0); return this.activities.filter((x) => types.includes(x.type));
} }
get activities() { get activities() {

2
test/parallel/test-repl-tab-complete.js

@ -411,7 +411,7 @@ const warningRegEx = new RegExp(
}); });
// no `biu` // no `biu`
assert.strictEqual(data.indexOf('ele.biu'), -1); assert.strictEqual(data.includes('ele.biu'), false);
})); }));
}); });

Loading…
Cancel
Save