Skip to content

Commit b6e9f99

Browse files
quinnlangillejasnell
authored andcommitted
test: removed mustCallAsync from common and added inside testcase
PR-URL: #23467 Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
1 parent cdca587 commit b6e9f99

File tree

4 files changed

+7
-21
lines changed

4 files changed

+7
-21
lines changed

test/common/README.md

-11
Original file line numberDiff line numberDiff line change
@@ -234,17 +234,6 @@ fail.
234234

235235
If `fn` is not provided, an empty function will be used.
236236

237-
### mustCallAsync([fn][, exact])
238-
* `fn` [&lt;Function>]
239-
* `exact` [&lt;number>] default = 1
240-
* return [&lt;Function>]
241-
242-
The same as `mustCall()`, except that it is also checked that the Promise
243-
returned by the function is fulfilled for each invocation of the function.
244-
245-
The return value of the wrapped function is the return value of the original
246-
function, if necessary wrapped as a promise.
247-
248237
### mustCallAtLeast([fn][, minimum])
249238
* `fn` [&lt;Function>] default = () => {}
250239
* `minimum` [&lt;number>] default = 1

test/common/index.js

-7
Original file line numberDiff line numberDiff line change
@@ -308,12 +308,6 @@ function mustCallAtLeast(fn, minimum) {
308308
return _mustCallInner(fn, minimum, 'minimum');
309309
}
310310

311-
function mustCallAsync(fn, exact) {
312-
return mustCall((...args) => {
313-
return Promise.resolve(fn(...args)).then(mustCall((val) => val));
314-
}, exact);
315-
}
316-
317311
function _mustCallInner(fn, criteria = 1, field) {
318312
if (process._exiting)
319313
throw new Error('Cannot use common.mustCall*() in process exit handler');
@@ -722,7 +716,6 @@ module.exports = {
722716
isWindows,
723717
localIPv6Hosts,
724718
mustCall,
725-
mustCallAsync,
726719
mustCallAtLeast,
727720
mustNotCall,
728721
nodeProcessAborted,

test/common/index.mjs

-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ const {
2626
allowGlobals,
2727
mustCall,
2828
mustCallAtLeast,
29-
mustCallAsync,
3029
hasMultiLocalhost,
3130
skipIfEslintMissing,
3231
canCreateSymLink,
@@ -74,7 +73,6 @@ export {
7473
allowGlobals,
7574
mustCall,
7675
mustCallAtLeast,
77-
mustCallAsync,
7876
hasMultiLocalhost,
7977
skipIfEslintMissing,
8078
canCreateSymLink,

test/parallel/test-http2-backpressure.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ const makeDuplexPair = require('../common/duplexpair');
1212
{
1313
let req;
1414
const server = http2.createServer();
15-
server.on('stream', common.mustCallAsync(async (stream, headers) => {
15+
server.on('stream', mustCallAsync(async (stream, headers) => {
1616
stream.respond({
1717
'content-type': 'text/html',
1818
':status': 200
@@ -45,3 +45,9 @@ function event(ee, eventName) {
4545
ee.once(eventName, common.mustCall(resolve));
4646
});
4747
}
48+
49+
function mustCallAsync(fn, exact) {
50+
return common.mustCall((...args) => {
51+
return Promise.resolve(fn(...args)).then(common.mustCall((val) => val));
52+
}, exact);
53+
}

0 commit comments

Comments
 (0)