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 <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>
1 parent 543d2de commit 3bdf7bf

3 files changed

Lines changed: 6 additions & 8 deletions

File tree

‎test/parallel/test-domain-crypto.js‎

Lines changed: 3 additions & 3 deletions
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‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ const common = require('../common');
33
constdomain=require('domain');
44
constassert=require('assert');
55

6-
lettimeout;
7-
86
consttimeoutd=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+
consttimeout=setTimeout(common.mustNotCall(),10*1000);

‎test/parallel/test-domain.js‎

Lines changed: 2 additions & 2 deletions
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-
constcommon=require('../common');
4+
require('../common');
55
constassert=require('assert');
66
constdomain=require('domain');
77
constevents=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
constd=newdomain.Domain();
243243
d.run(function(){
244244
process.nextTick(function(){

0 commit comments

Comments
 (0)