Browse Source

test: s/assert.notEqual()/assert.notStrictEqual()/

PR-URL: https://github.com/nodejs/node/pull/10541
Reviewed-By: Sam Roberts <vieuxtech@gmail.com>
Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Rich Trott <rtrott@gmail.com>
Reviewed-By: Italo A. Casas <me@italoacasas.com>
v7.x
cjihrig 8 years ago
committed by Italo A. Casas
parent
commit
50130220dc
No known key found for this signature in database GPG Key ID: 23EFEFE93C4CFFFE
  1. 2
      test/addons/load-long-path/test.js
  2. 4
      test/disabled/test-setuidgid.js
  3. 2
      test/doctool/test-doctool-html.js
  4. 6
      test/fixtures/not-main-module.js
  5. 2
      test/parallel/test-child-process-spawn-shell.js
  6. 2
      test/parallel/test-child-process-spawnsync-shell.js
  7. 2
      test/parallel/test-console.js
  8. 4
      test/parallel/test-crypto-fips.js
  9. 6
      test/parallel/test-crypto-hash.js
  10. 6
      test/parallel/test-domain-throw-error-then-throw-from-uncaught-exception-handler.js
  11. 4
      test/parallel/test-event-emitter-remove-all-listeners.js
  12. 4
      test/parallel/test-fs-access.js
  13. 4
      test/parallel/test-https-agent-disable-session-reuse.js
  14. 16
      test/parallel/test-https-agent-session-reuse.js
  15. 4
      test/parallel/test-module-loading-error.js
  16. 2
      test/parallel/test-net-keepalive.js
  17. 2
      test/parallel/test-net-listen-exclusive-random-ports.js
  18. 26
      test/parallel/test-net-remote-address-port.js
  19. 2
      test/parallel/test-process-cpuUsage.js
  20. 2
      test/parallel/test-regress-GH-7511.js
  21. 2
      test/parallel/test-regress-GH-node-9326.js
  22. 2
      test/parallel/test-require-extensions-same-filename-as-dir-trailing-slash.js
  23. 2
      test/parallel/test-socket-write-after-fin-error.js
  24. 2
      test/parallel/test-timers-unref-remove-other-unref-timers-only-one-fires.js
  25. 2
      test/parallel/test-tls-handshake-error.js
  26. 2
      test/parallel/test-tls-set-ciphers.js
  27. 10
      test/parallel/test-whatwg-url-searchparams-constructor.js
  28. 2
      test/parallel/test-whatwg-url-searchparams-get.js
  29. 2
      test/parallel/test-zlib-sync-no-event.js

2
test/addons/load-long-path/test.js

@ -33,5 +33,5 @@ fs.writeFileSync(addonDestinationPath, contents);
// Attempt to load at long path destination
const addon = require(addonDestinationPath);
assert.notEqual(addon, null);
assert.notStrictEqual(addon, null);
assert.strictEqual(addon.hello(), 'world');

4
test/disabled/test-setuidgid.js

@ -6,12 +6,12 @@ const assert = require('assert');
var oldgid = process.getgid();
process.setgid('nobody');
var newgid = process.getgid();
assert.notEqual(newgid, oldgid, 'gids expected to be different');
assert.notStrictEqual(newgid, oldgid, 'gids expected to be different');
var olduid = process.getuid();
process.setuid('nobody');
var newuid = process.getuid();
assert.notEqual(newuid, olduid, 'uids expected to be different');
assert.notStrictEqual(newuid, olduid, 'uids expected to be different');
try {
process.setuid('nobody1234');

2
test/doctool/test-doctool-html.js

@ -96,7 +96,7 @@ testData.forEach((item) => {
const actual = output.replace(/\s/g, '');
// Assert that the input stripped of all whitespace contains the
// expected list
assert.notEqual(actual.indexOf(expected), -1);
assert.notStrictEqual(actual.indexOf(expected), -1);
}));
}));
}));

6
test/fixtures/not-main-module.js

@ -1,4 +1,4 @@
const assert = require('assert');
assert.notEqual(module, require.main, 'require.main should not == module');
assert.notEqual(module, process.mainModule,
'process.mainModule should not === module');
assert.notStrictEqual(module, require.main, 'require.main should not == module');
assert.notStrictEqual(module, process.mainModule,
'process.mainModule should not === module');

2
test/parallel/test-child-process-spawn-shell.js

@ -6,7 +6,7 @@ const cp = require('child_process');
// Verify that a shell is, in fact, executed
const doesNotExist = cp.spawn('does-not-exist', {shell: true});
assert.notEqual(doesNotExist.spawnfile, 'does-not-exist');
assert.notStrictEqual(doesNotExist.spawnfile, 'does-not-exist');
doesNotExist.on('error', common.fail);
doesNotExist.on('exit', common.mustCall((code, signal) => {
assert.strictEqual(signal, null);

2
test/parallel/test-child-process-spawnsync-shell.js

@ -6,7 +6,7 @@ const cp = require('child_process');
// Verify that a shell is, in fact, executed
const doesNotExist = cp.spawnSync('does-not-exist', {shell: true});
assert.notEqual(doesNotExist.file, 'does-not-exist');
assert.notStrictEqual(doesNotExist.file, 'does-not-exist');
assert.strictEqual(doesNotExist.error, undefined);
assert.strictEqual(doesNotExist.signal, null);

2
test/parallel/test-console.js

@ -115,7 +115,7 @@ assert.strictEqual("{ foo: 'bar', inspect: [Function: inspect] }\n",
strings.shift());
assert.strictEqual("{ foo: 'bar', inspect: [Function: inspect] }\n",
strings.shift());
assert.notEqual(-1, strings.shift().indexOf('foo: [Object]'));
assert.ok(strings.shift().includes('foo: [Object]'));
assert.strictEqual(-1, strings.shift().indexOf('baz'));
assert.ok(/^label: \d+\.\d{3}ms$/.test(strings.shift().trim()));
assert.ok(/^__proto__: \d+\.\d{3}ms$/.test(strings.shift().trim()));

4
test/parallel/test-crypto-fips.js

@ -47,10 +47,10 @@ function testHelper(stream, args, expectedOutput, cmd, env) {
function responseHandler(buffer, expectedOutput) {
const response = buffer.toString();
assert.notEqual(0, response.length);
assert.notStrictEqual(response.length, 0);
if (FIPS_ENABLED !== expectedOutput && FIPS_DISABLED !== expectedOutput) {
// In the case of expected errors just look for a substring.
assert.notEqual(-1, response.indexOf(expectedOutput));
assert.ok(response.includes(expectedOutput));
} else {
// Normal path where we expect either FIPS enabled or disabled.
assert.strictEqual(expectedOutput, Number(response));

6
test/parallel/test-crypto-hash.js

@ -67,8 +67,8 @@ assert.deepStrictEqual(
// stream interface should produce the same result.
assert.deepStrictEqual(a5, a3, 'stream interface is consistent');
assert.deepStrictEqual(a6, a3, 'stream interface is consistent');
assert.notEqual(a7, undefined, 'no data should return data');
assert.notEqual(a8, undefined, 'empty string should generate data');
assert.notStrictEqual(a7, undefined, 'no data should return data');
assert.notStrictEqual(a8, undefined, 'empty string should generate data');
// Test multiple updates to same hash
var h1 = crypto.createHash('sha1').update('Test123').digest('hex');
@ -100,7 +100,7 @@ assert.strictEqual(
'4b21bbd1a68e690a730ddcb5a8bc94ead9879ffe82580767ad7ec6fa8ba2dea6' +
'43a821af66afa9a45b6a78c712fecf0e56dc7f43aef4bcfc8eb5b4d8dca6ea5b');
assert.notEqual(
assert.notStrictEqual(
hutf8,
crypto.createHash('sha512').update('УТФ-8 text', 'latin1').digest('hex'));

6
test/parallel/test-domain-throw-error-then-throw-from-uncaught-exception-handler.js

@ -72,9 +72,9 @@ function runTestWithAbortOnUncaughtException() {
child_process.exec(createTestCmdLine({
withAbortOnUncaughtException: true
}), function onTestDone(err, stdout, stderr) {
assert.notEqual(err.code, RAN_UNCAUGHT_EXCEPTION_HANDLER_EXIT_CODE,
'child process should not have run its uncaughtException ' +
'event handler');
assert.notStrictEqual(err.code, RAN_UNCAUGHT_EXCEPTION_HANDLER_EXIT_CODE,
'child process should not have run its ' +
'uncaughtException event handler');
assert(common.nodeProcessAborted(err.code, err.signal),
'process should have aborted, but did not');
});

4
test/parallel/test-event-emitter-remove-all-listeners.js

@ -39,8 +39,8 @@ function listener() {}
assert.deepStrictEqual(bazListeners, [listener, listener]);
// After calling removeAllListeners(),
// new listeners arrays is different from the old.
assert.notEqual(ee.listeners('bar'), barListeners);
assert.notEqual(ee.listeners('baz'), bazListeners);
assert.notStrictEqual(ee.listeners('bar'), barListeners);
assert.notStrictEqual(ee.listeners('baz'), bazListeners);
}
{

4
test/parallel/test-fs-access.js

@ -72,7 +72,7 @@ fs.access(__filename, fs.R_OK, common.mustCall((err) => {
}));
fs.access(doesNotExist, common.mustCall((err) => {
assert.notEqual(err, null, 'error should exist');
assert.notStrictEqual(err, null, 'error should exist');
assert.strictEqual(err.code, 'ENOENT');
assert.strictEqual(err.path, doesNotExist);
}));
@ -85,7 +85,7 @@ fs.access(readOnlyFile, fs.W_OK, common.mustCall((err) => {
if (hasWriteAccessForReadonlyFile) {
assert.ifError(err);
} else {
assert.notEqual(err, null, 'error should exist');
assert.notStrictEqual(err, null, 'error should exist');
assert.strictEqual(err.path, readOnlyFile);
}
}));

4
test/parallel/test-https-agent-disable-session-reuse.js

@ -54,6 +54,6 @@ const server = https.createServer(options, function(req, res) {
process.on('exit', function() {
assert.equal(serverRequests, TOTAL_REQS);
assert.equal(clientSessions.length, TOTAL_REQS);
assert.notEqual(clientSessions[0].toString('hex'),
clientSessions[1].toString('hex'));
assert.notStrictEqual(clientSessions[0].toString('hex'),
clientSessions[1].toString('hex'));
});

16
test/parallel/test-https-agent-session-reuse.js

@ -117,14 +117,14 @@ process.on('exit', function() {
assert.strictEqual(serverRequests, 6);
assert.strictEqual(clientSessions['first'].toString('hex'),
clientSessions['first-reuse'].toString('hex'));
assert.notEqual(clientSessions['first'].toString('hex'),
clientSessions['cipher-change'].toString('hex'));
assert.notEqual(clientSessions['first'].toString('hex'),
clientSessions['before-drop'].toString('hex'));
assert.notEqual(clientSessions['cipher-change'].toString('hex'),
clientSessions['before-drop'].toString('hex'));
assert.notEqual(clientSessions['before-drop'].toString('hex'),
clientSessions['after-drop'].toString('hex'));
assert.notStrictEqual(clientSessions['first'].toString('hex'),
clientSessions['cipher-change'].toString('hex'));
assert.notStrictEqual(clientSessions['first'].toString('hex'),
clientSessions['before-drop'].toString('hex'));
assert.notStrictEqual(clientSessions['cipher-change'].toString('hex'),
clientSessions['before-drop'].toString('hex'));
assert.notStrictEqual(clientSessions['before-drop'].toString('hex'),
clientSessions['after-drop'].toString('hex'));
assert.strictEqual(clientSessions['after-drop'].toString('hex'),
clientSessions['after-drop-reuse'].toString('hex'));
});

4
test/parallel/test-module-loading-error.js

@ -28,11 +28,11 @@ try {
try {
require();
} catch (e) {
assert.notEqual(e.toString().indexOf('missing path'), -1);
assert.ok(e.toString().includes('missing path'));
}
try {
require({});
} catch (e) {
assert.notEqual(e.toString().indexOf('path must be a string'), -1);
assert.ok(e.toString().includes('path must be a string'));
}

2
test/parallel/test-net-keepalive.js

@ -16,7 +16,7 @@ var echoServer = net.createServer(function(connection) {
echoServer.close();
}, 1), common.platformTimeout(100));
connection.setTimeout(0);
assert.notEqual(connection.setKeepAlive, undefined);
assert.notStrictEqual(connection.setKeepAlive, undefined);
// send a keepalive packet after 50 ms
connection.setKeepAlive(true, common.platformTimeout(50));
connection.on('end', function() {

2
test/parallel/test-net-listen-exclusive-random-ports.js

@ -15,7 +15,7 @@ if (cluster.isMaster) {
worker2.on('message', function(port2) {
assert.equal(port2, port2 | 0, 'second worker could not listen');
assert.notEqual(port1, port2, 'ports should not be equal');
assert.notStrictEqual(port1, port2, 'ports should not be equal');
worker1.kill();
worker2.kill();
});

26
test/parallel/test-net-remote-address-port.js

@ -13,16 +13,16 @@ var remoteFamilyCandidates = ['IPv4'];
if (common.hasIPv6) remoteFamilyCandidates.push('IPv6');
var server = net.createServer(common.mustCall(function(socket) {
assert.notEqual(-1, remoteAddrCandidates.indexOf(socket.remoteAddress));
assert.notEqual(-1, remoteFamilyCandidates.indexOf(socket.remoteFamily));
assert.ok(remoteAddrCandidates.includes(socket.remoteAddress));
assert.ok(remoteFamilyCandidates.includes(socket.remoteFamily));
assert.ok(socket.remotePort);
assert.notEqual(socket.remotePort, this.address().port);
assert.notStrictEqual(socket.remotePort, this.address().port);
socket.on('end', function() {
if (++conns_closed === 2) server.close();
});
socket.on('close', function() {
assert.notEqual(-1, remoteAddrCandidates.indexOf(socket.remoteAddress));
assert.notEqual(-1, remoteFamilyCandidates.indexOf(socket.remoteFamily));
assert.ok(remoteAddrCandidates.includes(socket.remoteAddress));
assert.ok(remoteFamilyCandidates.includes(socket.remoteFamily));
});
socket.resume();
}, 2));
@ -31,23 +31,23 @@ server.listen(0, 'localhost', function() {
var client = net.createConnection(this.address().port, 'localhost');
var client2 = net.createConnection(this.address().port);
client.on('connect', function() {
assert.notEqual(-1, remoteAddrCandidates.indexOf(client.remoteAddress));
assert.notEqual(-1, remoteFamilyCandidates.indexOf(client.remoteFamily));
assert.ok(remoteAddrCandidates.includes(client.remoteAddress));
assert.ok(remoteFamilyCandidates.includes(client.remoteFamily));
assert.strictEqual(client.remotePort, server.address().port);
client.end();
});
client.on('close', function() {
assert.notEqual(-1, remoteAddrCandidates.indexOf(client.remoteAddress));
assert.notEqual(-1, remoteFamilyCandidates.indexOf(client.remoteFamily));
assert.ok(remoteAddrCandidates.includes(client.remoteAddress));
assert.ok(remoteFamilyCandidates.includes(client.remoteFamily));
});
client2.on('connect', function() {
assert.notEqual(-1, remoteAddrCandidates.indexOf(client2.remoteAddress));
assert.notEqual(-1, remoteFamilyCandidates.indexOf(client2.remoteFamily));
assert.ok(remoteAddrCandidates.includes(client2.remoteAddress));
assert.ok(remoteFamilyCandidates.includes(client2.remoteFamily));
assert.strictEqual(client2.remotePort, server.address().port);
client2.end();
});
client2.on('close', function() {
assert.notEqual(-1, remoteAddrCandidates.indexOf(client2.remoteAddress));
assert.notEqual(-1, remoteFamilyCandidates.indexOf(client2.remoteFamily));
assert.ok(remoteAddrCandidates.includes(client2.remoteAddress));
assert.ok(remoteFamilyCandidates.includes(client2.remoteFamily));
});
});

2
test/parallel/test-process-cpuUsage.js

@ -87,7 +87,7 @@ assert.throws(() => {
// Ensure that the return value is the expected shape.
function validateResult(result) {
assert.notEqual(result, null);
assert.notStrictEqual(result, null);
assert(Number.isFinite(result.user));
assert(Number.isFinite(result.system));

2
test/parallel/test-regress-GH-7511.js

@ -6,5 +6,5 @@ const vm = require('vm');
assert.doesNotThrow(function() {
var context = vm.createContext({ process: process });
var result = vm.runInContext('process.env["PATH"]', context);
assert.notEqual(undefined, result);
assert.notStrictEqual(undefined, result);
});

2
test/parallel/test-regress-GH-node-9326.js

@ -10,5 +10,5 @@ var cp = child_process.spawn(process.execPath, [
]);
cp.on('exit', function(code) {
assert.notEqual(code, 0);
assert.notStrictEqual(code, 0);
});

2
test/parallel/test-require-extensions-same-filename-as-dir-trailing-slash.js

@ -6,5 +6,5 @@ const assert = require('assert');
const content = require(common.fixturesDir +
'/json-with-directory-name-module/module-stub/one-trailing-slash/two/three.js');
assert.notEqual(content.rocko, 'artischocko');
assert.notStrictEqual(content.rocko, 'artischocko');
assert.equal(content, 'hello from module-stub!');

2
test/parallel/test-socket-write-after-fin-error.js

@ -49,7 +49,7 @@ server.listen(0, function() {
assert(gotServerEnd);
assert(gotServerError);
assert.equal(gotServerError.code, 'EPIPE');
assert.notEqual(gotServerError.message, 'write after end');
assert.notStrictEqual(gotServerError.message, 'write after end');
console.log('ok');
});

2
test/parallel/test-timers-unref-remove-other-unref-timers-only-one-fires.js

@ -37,5 +37,5 @@ timers.enroll(foo, 1);
timers._unrefActive(foo);
setTimeout(function() {
assert.notEqual(nbTimersFired, 2);
assert.notStrictEqual(nbTimersFired, 2);
}, 20);

2
test/parallel/test-tls-handshake-error.js

@ -25,7 +25,7 @@ var server = tls.createServer({
});
c.on('error', common.mustCall(function(err) {
assert.notEqual(err.code, 'ECONNRESET');
assert.notStrictEqual(err.code, 'ECONNRESET');
}));
c.on('close', common.mustCall(function(err) {

2
test/parallel/test-tls-set-ciphers.js

@ -26,7 +26,7 @@ const reply = 'I AM THE WALRUS'; // something recognizable
let response = '';
process.on('exit', function() {
assert.notEqual(response.indexOf(reply), -1);
assert.ok(response.includes(reply));
});
const server = tls.createServer(options, common.mustCall(function(conn) {

10
test/parallel/test-whatwg-url-searchparams-constructor.js

@ -26,7 +26,7 @@ assert.throws(() => {
});
}, TypeError);
params = new URLSearchParams('');
assert.notEqual(params, null, 'constructor returned non-null value.');
assert.notStrictEqual(params, null, 'constructor returned non-null value.');
// eslint-disable-next-line no-proto
assert.strictEqual(params.__proto__, URLSearchParams.prototype,
'expected URLSearchParams.prototype as prototype.');
@ -36,19 +36,19 @@ assert.strictEqual(params + '', '%5Bobject%20Object%5D=');
// URLSearchParams constructor, string.
params = new URLSearchParams('a=b');
assert.notEqual(params, null, 'constructor returned non-null value.');
assert.notStrictEqual(params, null, 'constructor returned non-null value.');
assert.strictEqual(true, params.has('a'),
'Search params object has name "a"');
assert.strictEqual(false, params.has('b'),
'Search params object has not got name "b"');
params = new URLSearchParams('a=b&c');
assert.notEqual(params, null, 'constructor returned non-null value.');
assert.notStrictEqual(params, null, 'constructor returned non-null value.');
assert.strictEqual(true, params.has('a'),
'Search params object has name "a"');
assert.strictEqual(true, params.has('c'),
'Search params object has name "c"');
params = new URLSearchParams('&a&&& &&&&&a+b=& c&m%c3%b8%c3%b8');
assert.notEqual(params, null, 'constructor returned non-null value.');
assert.notStrictEqual(params, null, 'constructor returned non-null value.');
assert.strictEqual(true, params.has('a'), 'Search params object has name "a"');
assert.strictEqual(true, params.has('a b'),
'Search params object has name "a b"');
@ -64,7 +64,7 @@ assert.strictEqual(true, params.has('møø'),
// URLSearchParams constructor, object.
const seed = new URLSearchParams('a=b&c=d');
params = new URLSearchParams(seed);
assert.notEqual(params, null, 'constructor returned non-null value.');
assert.notStrictEqual(params, null, 'constructor returned non-null value.');
assert.strictEqual(params.get('a'), 'b');
assert.strictEqual(params.get('c'), 'd');
assert.strictEqual(false, params.has('d'));

2
test/parallel/test-whatwg-url-searchparams-get.js

@ -20,7 +20,7 @@ assert.strictEqual(params.get('a'), '');
// More get() basics
params = new URLSearchParams('first=second&third&&');
assert.notEqual(params, null, 'constructor returned non-null value.');
assert.notStrictEqual(params, null, 'constructor returned non-null value.');
assert.strictEqual(true, params.has('first'),
'Search params object has name "first"');
assert.strictEqual(params.get('first'), 'second',

2
test/parallel/test-zlib-sync-no-event.js

@ -17,5 +17,5 @@ const unzipper = new zlib.Gunzip();
unzipper.on('close', shouldNotBeCalled);
const unzipped = unzipper._processChunk(zipped, zlib.constants.Z_FINISH);
assert.notEqual(zipped.toString(), message);
assert.notStrictEqual(zipped.toString(), message);
assert.strictEqual(unzipped.toString(), message);

Loading…
Cancel
Save