Skip to content

Commit e5928ab

Browse files
Trottdanielleadams
authored andcommitted
test: remove unnecessary noop function args to mustCall()
PR-URL: #45027 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
1 parent 2aac993 commit e5928ab

22 files changed

+32
-32
lines changed

test/async-hooks/test-late-hook-enable.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ const fnsToTest = [setTimeout, (cb) => {
3333

3434
const hook = async_hooks.createHook({
3535
before: common.mustNotCall(),
36-
after: common.mustCall(() => {}, 3),
36+
after: common.mustCall(3),
3737
destroy: common.mustCall(() => {
3838
hook.disable();
3939
nextTest();

test/parallel/test-async-hooks-enable-before-promise-resolve.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const promise = new Promise((resolve) => {
1212
setTimeout(() => {
1313
initialAsyncId = async_hooks.executionAsyncId();
1414
async_hooks.createHook({
15-
after: common.mustCall(() => {}, 2)
15+
after: common.mustCall(2)
1616
}).enable();
1717
resolve();
1818
}, 0);

test/parallel/test-async-hooks-enable-disable.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ const assert = require('assert');
44
const async_hooks = require('async_hooks');
55

66
const hook = async_hooks.createHook({
7-
init: common.mustCall(() => {}, 1),
7+
init: common.mustCall(1),
88
before: common.mustNotCall(),
99
after: common.mustNotCall(),
1010
destroy: common.mustNotCall()

test/parallel/test-cluster-worker-kill-signal.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,5 @@ if (cluster.isWorker) {
4545
}, 1));
4646

4747
// Check if the cluster was killed as well
48-
cluster.on('exit', common.mustCall(() => {}, 1));
48+
cluster.on('exit', common.mustCall(1));
4949
}

test/parallel/test-common.js

+6-6
Original file line numberDiff line numberDiff line change
@@ -70,20 +70,20 @@ assert.throws(
7070
message: /^fhqwhgads$/
7171
});
7272

73-
const fnOnce = common.mustCall(() => {});
73+
const fnOnce = common.mustCall();
7474
fnOnce();
75-
const fnTwice = common.mustCall(() => {}, 2);
75+
const fnTwice = common.mustCall(2);
7676
fnTwice();
7777
fnTwice();
78-
const fnAtLeast1Called1 = common.mustCallAtLeast(() => {}, 1);
78+
const fnAtLeast1Called1 = common.mustCallAtLeast(1);
7979
fnAtLeast1Called1();
80-
const fnAtLeast1Called2 = common.mustCallAtLeast(() => {}, 1);
80+
const fnAtLeast1Called2 = common.mustCallAtLeast(1);
8181
fnAtLeast1Called2();
8282
fnAtLeast1Called2();
83-
const fnAtLeast2Called2 = common.mustCallAtLeast(() => {}, 2);
83+
const fnAtLeast2Called2 = common.mustCallAtLeast(2);
8484
fnAtLeast2Called2();
8585
fnAtLeast2Called2();
86-
const fnAtLeast2Called3 = common.mustCallAtLeast(() => {}, 2);
86+
const fnAtLeast2Called3 = common.mustCallAtLeast(2);
8787
fnAtLeast2Called3();
8888
fnAtLeast2Called3();
8989
fnAtLeast2Called3();

test/parallel/test-dgram-bind-fd.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ const BUFFER_SIZE = 4096;
9595
assert.fail(err.message);
9696
});
9797

98-
socket.on('close', common.mustCall(() => {}));
98+
socket.on('close', common.mustCall());
9999
}));
100100

101101
receiver.on('message', common.mustCall((data, { address, port }) => {
@@ -109,7 +109,7 @@ const BUFFER_SIZE = 4096;
109109
assert.fail(err.message);
110110
});
111111

112-
receiver.on('close', common.mustCall(() => {}));
112+
receiver.on('close', common.mustCall());
113113
}
114114

115115
testWithOptions(true, true);

test/parallel/test-dns-get-server.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,5 @@ const { Resolver } = require('dns');
77
const resolver = new Resolver();
88
assert(resolver.getServers().length > 0);
99
// return undefined
10-
resolver._handle.getServers = common.mustCall(() => {});
10+
resolver._handle.getServers = common.mustCall();
1111
assert.strictEqual(resolver.getServers().length, 0);

test/parallel/test-fs-stat.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -151,12 +151,12 @@ fs.stat(__filename, common.mustSucceed((s) => {
151151
});
152152

153153
// Should not throw an error
154-
fs.stat(__filename, undefined, common.mustCall(() => {}));
154+
fs.stat(__filename, undefined, common.mustCall());
155155

156156
fs.open(__filename, 'r', undefined, common.mustCall((err, fd) => {
157157
// Should not throw an error
158-
fs.fstat(fd, undefined, common.mustCall(() => {}));
158+
fs.fstat(fd, undefined, common.mustCall());
159159
}));
160160

161161
// Should not throw an error
162-
fs.lstat(__filename, undefined, common.mustCall(() => {}));
162+
fs.lstat(__filename, undefined, common.mustCall());

test/parallel/test-fs-watch-close-when-destroyed.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,6 @@ watcher.addListener('change', () => {
3737
fs.rmdirSync(root);
3838
// Wait for the listener to hit
3939
setTimeout(
40-
common.mustCall(() => {}),
40+
common.mustCall(),
4141
common.platformTimeout(100)
4242
);

test/parallel/test-http2-respond-with-file-connection-abort.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ server.listen(0, common.mustCall(() => {
2323
const client = http2.connect(`http://localhost:${server.address().port}`);
2424
const req = client.request();
2525

26-
req.on('response', common.mustCall(() => {}));
26+
req.on('response', common.mustCall());
2727
req.once('data', common.mustCall(() => {
2828
net.Socket.prototype.destroy.call(client.socket);
2929
server.close();

test/parallel/test-http2-window-size.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,4 +100,4 @@ for (const buffers of buffersList) {
100100
p = p.then(() => run(buffers, initialWindowSize));
101101
}
102102
}
103-
p.then(common.mustCall(() => {}));
103+
p.then(common.mustCall());

test/parallel/test-net-socket-end-callback.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ server.listen(common.mustCall(() => {
1414
});
1515
};
1616

17-
const cb = common.mustCall(() => {}, 3);
17+
const cb = common.mustCall(3);
1818

1919
connect(cb);
2020
connect('foo', cb);

test/parallel/test-net-socket-setnodelay.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ falseyValues.forEach((testVal) => socket.setNoDelay(testVal));
3737

3838
socket = new net.Socket({
3939
handle: {
40-
setNoDelay: common.mustCall(() => {}, 3),
40+
setNoDelay: common.mustCall(3),
4141
readStart() {}
4242
}
4343
});

test/parallel/test-promise-hook-exceptions.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,6 @@ testHook('onSettled');
2626
testHook('onBefore');
2727
testHook('onAfter');
2828

29-
const stop = promiseHooks.onInit(common.mustCall(() => {}, 2));
29+
const stop = promiseHooks.onInit(common.mustCall(2));
3030

3131
Promise.resolve().then(stop);

test/parallel/test-stream-duplex-from.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ const { Blob } = require('buffer');
142142
}
143143
assert.strictEqual(ret, 'abcdefghi');
144144
},
145-
common.mustCall(() => {}),
145+
common.mustCall(),
146146
);
147147
}
148148

test/parallel/test-stream-pipeline-queued-end-in-destroy.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const { Readable, Duplex, pipeline } = require('stream');
99
// Refs: https://github.com/nodejs/node/issues/24456
1010

1111
const readable = new Readable({
12-
read: common.mustCall(() => {})
12+
read: common.mustCall()
1313
});
1414

1515
const duplex = new Duplex({

test/parallel/test-stream-pipeline-with-empty-string.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@ async function runTest() {
1515
);
1616
}
1717

18-
runTest().then(common.mustCall(() => {}));
18+
runTest().then(common.mustCall());

test/parallel/test-stream-readable-unshift.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,6 @@ const { Readable } = require('stream');
165165

166166
const stream = new ArrayReader();
167167
stream.once('readable', common.mustCall(onRead));
168-
stream.on('end', common.mustCall(() => {}));
168+
stream.on('end', common.mustCall());
169169

170170
}

test/parallel/test-tls-close-notify.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const server = tls.createServer({
4545
}, common.mustCall(function() {
4646
// Send close-notify without shutting down TCP socket.
4747
const req = new ShutdownWrap();
48-
req.oncomplete = common.mustCall(() => {});
48+
req.oncomplete = common.mustCall();
4949
req.handle = c._handle;
5050
c._handle.shutdown(req);
5151
}));

test/parallel/test-ttywrap-stack.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ const common = require('../common');
55
// will not crash the process if there
66
// is not enough space on the V8 stack
77

8-
const done = common.mustCall(() => {});
8+
const done = common.mustCall();
99

1010
async function test() {
1111
await test();

test/parallel/test-worker-data-url.js

+3-3
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ new Worker(new URL('data:text/javascript,export{}'))
1010
.on('error', common.mustNotCall(() => {}));
1111

1212
new Worker(new URL('data:text/plain,'))
13-
.on('error', common.mustCall(() => {}));
13+
.on('error', common.mustCall());
1414
new Worker(new URL('data:text/javascript,module.exports={}'))
15-
.on('error', common.mustCall(() => {}));
15+
.on('error', common.mustCall());
1616

1717
new Worker(new URL('data:text/javascript,await Promise.resolve()'))
1818
.on('error', common.mustNotCall(() => {}));
1919
new Worker(new URL('data:text/javascript,await Promise.reject()'))
20-
.on('error', common.mustCall(() => {}));
20+
.on('error', common.mustCall());
2121
new Worker(new URL('data:text/javascript,await new Promise(()=>{})'))
2222
.on(
2323
'exit',

test/sequential/test-tls-lookup.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const tls = require('tls');
2121
});
2222
});
2323

24-
connectDoesNotThrow(common.mustCall(() => {}));
24+
connectDoesNotThrow(common.mustCall());
2525

2626
function connectDoesNotThrow(input) {
2727
const opts = {

0 commit comments

Comments
 (0)