Skip to content

Commit

Permalink
test: replace indexOf with includes
Browse files Browse the repository at this point in the history
Refs: #12586
PR-URL: #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>
  • Loading branch information
maasencioh authored and jasnell committed Aug 8, 2017
1 parent e67220e commit 9564c20
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions test/async-hooks/init-hooks.js
Expand Up @@ -67,7 +67,7 @@ class ActivityCollector {
const violations = [];
function v(msg) { violations.push(msg); }
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) {
v('Activity inited twice\n' + activityString(a) +
Expand Down Expand Up @@ -131,7 +131,7 @@ class ActivityCollector {

activitiesOfTypes(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() {
Expand Down
2 changes: 1 addition & 1 deletion test/parallel/test-repl-tab-complete.js
Expand Up @@ -411,7 +411,7 @@ const warningRegEx = new RegExp(
});

// no `biu`
assert.strictEqual(data.indexOf('ele.biu'), -1);
assert.strictEqual(data.includes('ele.biu'), false);
}));
});

Expand Down

0 comments on commit 9564c20

Please sign in to comment.