Skip to content

Commit

Permalink
test: refactor domain tests
Browse files Browse the repository at this point in the history
* Check that noop callback is or isn't invoked as appropriate using
  common.mustCall() and common.mustNotCall()
* Fix typo in array literal

PR-URL: #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>
  • Loading branch information
Trott authored and addaleax committed Jun 10, 2017
1 parent fe5ea3f commit ad07c46
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions test/parallel/test-domain-crypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -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());
2 changes: 1 addition & 1 deletion test/parallel/test-domain-timers.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,4 +51,4 @@ immediated.run(function() {
});
});

const timeout = setTimeout(common.noop, 10 * 1000);
const timeout = setTimeout(common.mustNotCall(), 10 * 1000);
4 changes: 2 additions & 2 deletions test/parallel/test-domain.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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() {
Expand Down

0 comments on commit ad07c46

Please sign in to comment.