From 6d5ded508e504d90cdd1058fce6f04a4433dd86c Mon Sep 17 00:00:00 2001 From: Johnny Reading Date: Thu, 1 Dec 2016 10:11:46 -0600 Subject: [PATCH] test: refactor test-domain Use assert.strictEqual() instead of assert.equal(). PR-URL: https://github.com/nodejs/node/pull/9890 Reviewed-By: Colin Ihrig Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- test/parallel/test-domain.js | 67 ++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/test/parallel/test-domain.js b/test/parallel/test-domain.js index 19cd964a28923a..69521108f6e47b 100644 --- a/test/parallel/test-domain.js +++ b/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');