diff --git a/test/common/README.md b/test/common/README.md index 0a2281b091b267..63b7905113f577 100644 --- a/test/common/README.md +++ b/test/common/README.md @@ -234,17 +234,6 @@ fail. If `fn` is not provided, an empty function will be used. -### mustCallAsync([fn][, exact]) -* `fn` [<Function>] -* `exact` [<number>] default = 1 -* return [<Function>] - -The same as `mustCall()`, except that it is also checked that the Promise -returned by the function is fulfilled for each invocation of the function. - -The return value of the wrapped function is the return value of the original -function, if necessary wrapped as a promise. - ### mustCallAtLeast([fn][, minimum]) * `fn` [<Function>] default = () => {} * `minimum` [<number>] default = 1 diff --git a/test/common/index.js b/test/common/index.js index 9cbf9189690600..53977beef5bc74 100644 --- a/test/common/index.js +++ b/test/common/index.js @@ -308,12 +308,6 @@ function mustCallAtLeast(fn, minimum) { return _mustCallInner(fn, minimum, 'minimum'); } -function mustCallAsync(fn, exact) { - return mustCall((...args) => { - return Promise.resolve(fn(...args)).then(mustCall((val) => val)); - }, exact); -} - function _mustCallInner(fn, criteria = 1, field) { if (process._exiting) throw new Error('Cannot use common.mustCall*() in process exit handler'); @@ -722,7 +716,6 @@ module.exports = { isWindows, localIPv6Hosts, mustCall, - mustCallAsync, mustCallAtLeast, mustNotCall, nodeProcessAborted, diff --git a/test/common/index.mjs b/test/common/index.mjs index bead7333d12e81..068dd35049c301 100644 --- a/test/common/index.mjs +++ b/test/common/index.mjs @@ -26,7 +26,6 @@ const { allowGlobals, mustCall, mustCallAtLeast, - mustCallAsync, hasMultiLocalhost, skipIfEslintMissing, canCreateSymLink, @@ -74,7 +73,6 @@ export { allowGlobals, mustCall, mustCallAtLeast, - mustCallAsync, hasMultiLocalhost, skipIfEslintMissing, canCreateSymLink, diff --git a/test/parallel/test-http2-backpressure.js b/test/parallel/test-http2-backpressure.js index db58e8da33df33..1f9687831eb1a8 100644 --- a/test/parallel/test-http2-backpressure.js +++ b/test/parallel/test-http2-backpressure.js @@ -12,7 +12,7 @@ const makeDuplexPair = require('../common/duplexpair'); { let req; const server = http2.createServer(); - server.on('stream', common.mustCallAsync(async (stream, headers) => { + server.on('stream', mustCallAsync(async (stream, headers) => { stream.respond({ 'content-type': 'text/html', ':status': 200 @@ -45,3 +45,9 @@ function event(ee, eventName) { ee.once(eventName, common.mustCall(resolve)); }); } + +function mustCallAsync(fn, exact) { + return common.mustCall((...args) => { + return Promise.resolve(fn(...args)).then(common.mustCall((val) => val)); + }, exact); +}