From 9564c20810d7dccaae8bb917251681051a2a1144 Mon Sep 17 00:00:00 2001 From: Miguel Angel Asencio Hurtado Date: Fri, 4 Aug 2017 17:13:36 +0200 Subject: [PATCH] test: replace indexOf with includes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Refs: https://github.com/nodejs/node/issues/12586 PR-URL: https://github.com/nodejs/node/pull/14630 Reviewed-By: Colin Ihrig Reviewed-By: Vse Mozhet Byt Reviewed-By: Tobias Nießen Reviewed-By: Anna Henningsen Reviewed-By: Michaël Zasso Reviewed-By: James M Snell Reviewed-By: Yuta Hiroto Reviewed-By: Timothy Gu Reviewed-By: Alexey Orlenko --- test/async-hooks/init-hooks.js | 4 ++-- test/parallel/test-repl-tab-complete.js | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/async-hooks/init-hooks.js b/test/async-hooks/init-hooks.js index c99383204ffe03..a5f835cdff3aaa 100644 --- a/test/async-hooks/init-hooks.js +++ b/test/async-hooks/init-hooks.js @@ -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) + @@ -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() { diff --git a/test/parallel/test-repl-tab-complete.js b/test/parallel/test-repl-tab-complete.js index 994421ffc58a6a..85bcaf9e618ebc 100644 --- a/test/parallel/test-repl-tab-complete.js +++ b/test/parallel/test-repl-tab-complete.js @@ -411,7 +411,7 @@ const warningRegEx = new RegExp( }); // no `biu` - assert.strictEqual(data.indexOf('ele.biu'), -1); + assert.strictEqual(data.includes('ele.biu'), false); })); });