Browse Source

test: refactor test-domain

Use assert.strictEqual() instead of assert.equal().

PR-URL: https://github.com/nodejs/node/pull/9890
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
v6.x
Johnny Reading 8 years ago
committed by Anna Henningsen
parent
commit
6fc75ba498
No known key found for this signature in database GPG Key ID: D8B9F5AEAE84E4CF
  1. 67
      test/parallel/test-domain.js

67
test/parallel/test-domain.js

@ -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;
@ -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');
});
@ -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);
@ -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);
@ -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');

Loading…
Cancel
Save