Skip to content

Commit 3bdf7bf

Browse files
TrottMylesBorins
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 543d2de commit 3bdf7bf

File tree

3 files changed

+6
-8
lines changed

3 files changed

+6
-8
lines changed

test/parallel/test-domain-crypto.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ global.domain = require('domain');
1717

1818
// should not throw a 'TypeError: undefined is not a function' exception
1919
crypto.randomBytes(8);
20-
crypto.randomBytes(8, common.noop);
20+
crypto.randomBytes(8, common.mustCall());
2121
crypto.pseudoRandomBytes(8);
22-
crypto.pseudoRandomBytes(8, common.noop);
23-
crypto.pbkdf2('password', 'salt', 8, 8, common.noop);
22+
crypto.pseudoRandomBytes(8, common.mustCall());
23+
crypto.pbkdf2('password', 'salt', 8, 8, 'sha1', common.mustCall());

test/parallel/test-domain-timers.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ const common = require('../common');
33
const domain = require('domain');
44
const assert = require('assert');
55

6-
let timeout;
7-
86
const timeoutd = domain.create();
97

108
timeoutd.on('error', common.mustCall(function(e) {
@@ -32,4 +30,4 @@ immediated.run(function() {
3230
});
3331
});
3432

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

test/parallel/test-domain.js

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

4-
const common = require('../common');
4+
require('../common');
55
const assert = require('assert');
66
const domain = require('domain');
77
const events = require('events');
@@ -238,7 +238,7 @@ let fst = fs.createReadStream('stream for nonexistent file');
238238
d.add(fst);
239239
expectCaught++;
240240

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

0 commit comments

Comments
 (0)