mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
test: improve coverage for util.promisify
Add a test that confirms that non-function arguments passed to util.promisify throw an ERR_INVALID_ARG_TYPE error. PR-URL: https://github.com/nodejs/node/pull/17591 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me> Reviewed-By: Michael Dawson <michael_dawson@ca.ibm.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com> Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
This commit is contained in:
1 parent
decab712ba
commit
f86427eae8
1 file changed
+10
@@ -184,3 +184,13 @@ const stat = promisify(fs.stat);
|
||||
})
|
||||
]);
|
||||
}
|
||||
|
||||
[undefined, null, true, 0, 'str', {}, [], Symbol()].forEach((input) => {
|
||||
common.expectsError(
|
||||
() => promisify(input),
|
||||
{
|
||||
code: 'ERR_INVALID_ARG_TYPE',
|
||||
type: TypeError,
|
||||
message: 'The "original" argument must be of type Function'
|
||||
});
|
||||
});
|
||||
Reference in new issue
Block a user