Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: use strictEqual instead of equal in test-domain #9890

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 34 additions & 33 deletions test/parallel/test-domain.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,67 +31,67 @@ d.on('error', function(er) {

switch (er_message) {
case 'emitted':
assert.equal(er.domain, d);
assert.equal(er.domainEmitter, e);
assert.equal(er.domainThrown, false);
assert.strictEqual(er.domain, d);
assert.strictEqual(er.domainEmitter, e);
assert.strictEqual(er.domainThrown, false);
break;

case 'bound':
assert.ok(!er.domainEmitter);
assert.equal(er.domain, d);
assert.equal(er.domainBound, fn);
assert.equal(er.domainThrown, false);
assert.strictEqual(er.domain, d);
assert.strictEqual(er.domainBound, fn);
assert.strictEqual(er.domainThrown, false);
break;

case 'thrown':
assert.ok(!er.domainEmitter);
assert.equal(er.domain, d);
assert.equal(er.domainThrown, true);
assert.strictEqual(er.domain, d);
assert.strictEqual(er.domainThrown, true);
break;

case "ENOENT: no such file or directory, open 'this file does not exist'":
assert.equal(er.domain, d);
assert.equal(er.domainThrown, false);
assert.equal(typeof er.domainBound, 'function');
assert.strictEqual(er.domain, d);
assert.strictEqual(er.domainThrown, false);
assert.strictEqual(typeof er.domainBound, 'function');
assert.ok(!er.domainEmitter);
assert.equal(er.code, 'ENOENT');
assert.equal(er_path, 'this file does not exist');
assert.equal(typeof er.errno, 'number');
assert.strictEqual(er.code, 'ENOENT');
assert.strictEqual(er_path, 'this file does not exist');
assert.strictEqual(typeof er.errno, 'number');
break;

case
"ENOENT: no such file or directory, open 'stream for nonexistent file'":
assert.equal(typeof er.errno, 'number');
assert.equal(er.code, 'ENOENT');
assert.equal(er_path, 'stream for nonexistent file');
assert.equal(er.domain, d);
assert.equal(er.domainEmitter, fst);
assert.strictEqual(typeof er.errno, 'number');
assert.strictEqual(er.code, 'ENOENT');
assert.strictEqual(er_path, 'stream for nonexistent file');
assert.strictEqual(er.domain, d);
assert.strictEqual(er.domainEmitter, fst);
assert.ok(!er.domainBound);
assert.equal(er.domainThrown, false);
assert.strictEqual(er.domainThrown, false);
break;

case 'implicit':
assert.equal(er.domainEmitter, implicit);
assert.equal(er.domain, d);
assert.equal(er.domainThrown, false);
assert.strictEqual(er.domainEmitter, implicit);
assert.strictEqual(er.domain, d);
assert.strictEqual(er.domainThrown, false);
assert.ok(!er.domainBound);
break;

case 'implicit timer':
assert.equal(er.domain, d);
assert.equal(er.domainThrown, true);
assert.strictEqual(er.domain, d);
assert.strictEqual(er.domainThrown, true);
assert.ok(!er.domainEmitter);
assert.ok(!er.domainBound);
break;

case 'Cannot read property \'isDirectory\' of undefined':
assert.equal(er.domain, d);
assert.strictEqual(er.domain, d);
assert.ok(!er.domainEmitter);
assert.ok(!er.domainBound);
break;

case 'nextTick execution loop':
assert.equal(er.domain, d);
assert.strictEqual(er.domain, d);
assert.ok(!er.domainEmitter);
assert.ok(!er.domainBound);
break;
Expand All @@ -107,7 +107,8 @@ d.on('error', function(er) {

process.on('exit', function() {
console.error('exit', caught, expectCaught);
assert.equal(caught, expectCaught, 'caught the expected number of errors');
assert.strictEqual(caught, expectCaught,
'caught the expected number of errors');
console.log('ok');
});

Expand Down Expand Up @@ -172,7 +173,7 @@ expectCaught++;

// intercepted should never pass first argument to callback
function fn2(data) {
assert.equal(data, 'data', 'should not be null err argument');
assert.strictEqual(data, 'data', 'should not be null err argument');
}

bound = d.intercept(fn2);
Expand All @@ -181,8 +182,8 @@ bound(null, 'data');
// intercepted should never pass first argument to callback
// even if arguments length is more than 2.
function fn3(data, data2) {
assert.equal(data, 'data', 'should not be null err argument');
assert.equal(data2, 'data2', 'should not be data argument');
assert.strictEqual(data, 'data', 'should not be null err argument');
assert.strictEqual(data2, 'data2', 'should not be data argument');
}

bound = d.intercept(fn3);
Expand Down Expand Up @@ -225,14 +226,14 @@ expectCaught++;
var result = d.run(function() {
return 'return value';
});
assert.equal(result, 'return value');
assert.strictEqual(result, 'return value');


// check if the executed function take in count the applied parameters
result = d.run(function(a, b) {
return a + ' ' + b;
}, 'return', 'value');
assert.equal(result, 'return value');
assert.strictEqual(result, 'return value');


var fst = fs.createReadStream('stream for nonexistent file');
Expand Down