Skip to content

Commit ad07c46

Browse files
Trottaddaleax
authored andcommitted
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: #13480 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Refael Ackermann <[email protected]> Reviewed-By: Colin Ihrig <[email protected]> Reviewed-By: Luigi Pinca <[email protected]> Reviewed-By: Michael Dawson <[email protected]>
1 parent fe5ea3f commit ad07c46

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

test/parallel/test-domain-crypto.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ global.domain = require('domain');
3737

3838
// should not throw a 'TypeError: undefined is not a function' exception
3939
crypto.randomBytes(8);
40-
crypto.randomBytes(8, common.noop);
40+
crypto.randomBytes(8, common.mustCall());
4141
const buf = Buffer.alloc(8);
4242
crypto.randomFillSync(buf);
4343
crypto.pseudoRandomBytes(8);
44-
crypto.pseudoRandomBytes(8, common.noop);
45-
crypto.pbkdf2('password', 'salt', 8, 8, 'sha1', common.noop);
44+
crypto.pseudoRandomBytes(8, common.mustCall());
45+
crypto.pbkdf2('password', 'salt', 8, 8, 'sha1', common.mustCall());

test/parallel/test-domain-timers.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -51,4 +51,4 @@ immediated.run(function() {
5151
});
5252
});
5353

54-
const timeout = setTimeout(common.noop, 10 * 1000);
54+
const timeout = setTimeout(common.mustNotCall(), 10 * 1000);

test/parallel/test-domain.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
'use strict';
2323
// Simple tests of most basic domain functionality.
2424

25-
const common = require('../common');
25+
require('../common');
2626
const assert = require('assert');
2727
const domain = require('domain');
2828
const events = require('events');
@@ -259,7 +259,7 @@ const fst = fs.createReadStream('stream for nonexistent file');
259259
d.add(fst);
260260
expectCaught++;
261261

262-
[42, null, , false, common.noop, 'string'].forEach(function(something) {
262+
[42, null, undefined, false, () => {}, 'string'].forEach(function(something) {
263263
const d = new domain.Domain();
264264
d.run(function() {
265265
process.nextTick(function() {

0 commit comments

Comments
 (0)