diff options
author | Rich Trott <rtrott@gmail.com> | 2017-06-05 11:22:26 -0700 |
---|---|---|
committer | Anna Henningsen <anna@addaleax.net> | 2017-06-10 17:53:17 +0200 |
commit | ad07c46b004264c6a6a1b4719a1d6d0563393f86 (patch) | |
tree | bf2173ce56faae022893017d81fdfde114163b7b /test/parallel | |
parent | fe5ea3feb0c5ad027865369e92d7fddef1318509 (diff) | |
download | node-new-ad07c46b004264c6a6a1b4719a1d6d0563393f86.tar.gz |
test: refactor domain tests
* Check that noop callback is or isn't invoked as appropriate using
common.mustCall() and common.mustNotCall()
* Fix typo in array literal
PR-URL: https://github.com/nodejs/node/pull/13480
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Refael Ackermann <refack@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com>
Diffstat (limited to 'test/parallel')
-rw-r--r-- | test/parallel/test-domain-crypto.js | 6 | ||||
-rw-r--r-- | test/parallel/test-domain-timers.js | 2 | ||||
-rw-r--r-- | test/parallel/test-domain.js | 4 |
3 files changed, 6 insertions, 6 deletions
diff --git a/test/parallel/test-domain-crypto.js b/test/parallel/test-domain-crypto.js index acc90a4a48..d0bdbf4720 100644 --- a/test/parallel/test-domain-crypto.js +++ b/test/parallel/test-domain-crypto.js @@ -37,9 +37,9 @@ global.domain = require('domain'); // should not throw a 'TypeError: undefined is not a function' exception crypto.randomBytes(8); -crypto.randomBytes(8, common.noop); +crypto.randomBytes(8, common.mustCall()); const buf = Buffer.alloc(8); crypto.randomFillSync(buf); crypto.pseudoRandomBytes(8); -crypto.pseudoRandomBytes(8, common.noop); -crypto.pbkdf2('password', 'salt', 8, 8, 'sha1', common.noop); +crypto.pseudoRandomBytes(8, common.mustCall()); +crypto.pbkdf2('password', 'salt', 8, 8, 'sha1', common.mustCall()); diff --git a/test/parallel/test-domain-timers.js b/test/parallel/test-domain-timers.js index 888b452cb9..fe7247b2a9 100644 --- a/test/parallel/test-domain-timers.js +++ b/test/parallel/test-domain-timers.js @@ -51,4 +51,4 @@ immediated.run(function() { }); }); -const timeout = setTimeout(common.noop, 10 * 1000); +const timeout = setTimeout(common.mustNotCall(), 10 * 1000); diff --git a/test/parallel/test-domain.js b/test/parallel/test-domain.js index 1b6e1c7bbf..6cef4e5293 100644 --- a/test/parallel/test-domain.js +++ b/test/parallel/test-domain.js @@ -22,7 +22,7 @@ 'use strict'; // Simple tests of most basic domain functionality. -const common = require('../common'); +require('../common'); const assert = require('assert'); const domain = require('domain'); const events = require('events'); @@ -259,7 +259,7 @@ const fst = fs.createReadStream('stream for nonexistent file'); d.add(fst); expectCaught++; -[42, null, , false, common.noop, 'string'].forEach(function(something) { +[42, null, undefined, false, () => {}, 'string'].forEach(function(something) { const d = new domain.Domain(); d.run(function() { process.nextTick(function() { |