Skip to content

Commit bc710ef

Browse files
mikeswoodsFishrock123
authored andcommitted
test: cleanup/update test-os.js
Replaced `==` with `=== Replaced `indexOf(...) !== -1` with `includes()` PR-URL: #8761 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Ilkka Myller <ilkka.myller@nodefield.com>
1 parent 324c8b5 commit bc710ef

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

test/parallel/test-os.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ console.error(interfaces);
101101
switch (platform) {
102102
case 'linux':
103103
{
104-
const filter = function(e) { return e.address == '127.0.0.1'; };
104+
const filter = function(e) { return e.address === '127.0.0.1'; };
105105
const actual = interfaces.lo.filter(filter);
106106
const expected = [{ address: '127.0.0.1', netmask: '255.0.0.0',
107107
mac: '00:00:00:00:00:00', family: 'IPv4',
@@ -111,7 +111,7 @@ switch (platform) {
111111
}
112112
case 'win32':
113113
{
114-
const filter = function(e) { return e.address == '127.0.0.1'; };
114+
const filter = function(e) { return e.address === '127.0.0.1'; };
115115
const actual = interfaces['Loopback Pseudo-Interface 1'].filter(filter);
116116
const expected = [{ address: '127.0.0.1', netmask: '255.0.0.0',
117117
mac: '00:00:00:00:00:00', family: 'IPv4',
@@ -129,17 +129,17 @@ const home = os.homedir();
129129

130130
console.log('homedir = ' + home);
131131
is.string(home);
132-
assert.ok(home.indexOf(path.sep) !== -1);
132+
assert.ok(home.includes(path.sep));
133133

134134
if (common.isWindows && process.env.USERPROFILE) {
135135
assert.strictEqual(home, process.env.USERPROFILE);
136136
delete process.env.USERPROFILE;
137-
assert.ok(os.homedir().indexOf(path.sep) !== -1);
137+
assert.ok(os.homedir().includes(path.sep));
138138
process.env.USERPROFILE = home;
139139
} else if (!common.isWindows && process.env.HOME) {
140140
assert.strictEqual(home, process.env.HOME);
141141
delete process.env.HOME;
142-
assert.ok(os.homedir().indexOf(path.sep) !== -1);
142+
assert.ok(os.homedir().includes(path.sep));
143143
process.env.HOME = home;
144144
}
145145

@@ -157,13 +157,13 @@ if (common.isWindows) {
157157
} else {
158158
is.number(pwd.uid);
159159
is.number(pwd.gid);
160-
assert.notStrictEqual(pwd.shell.indexOf(path.sep), -1);
160+
assert.ok(pwd.shell.includes(path.sep));
161161
assert.strictEqual(pwd.uid, pwdBuf.uid);
162162
assert.strictEqual(pwd.gid, pwdBuf.gid);
163163
assert.strictEqual(pwd.shell, pwdBuf.shell.toString('utf8'));
164164
}
165165

166166
is.string(pwd.username);
167-
assert.notStrictEqual(pwd.homedir.indexOf(path.sep), -1);
167+
assert.ok(pwd.homedir.includes(path.sep));
168168
assert.strictEqual(pwd.username, pwdBuf.username.toString('utf8'));
169169
assert.strictEqual(pwd.homedir, pwdBuf.homedir.toString('utf8'));

0 commit comments

Comments
 (0)