Skip to content

Commit

Permalink
test: improve coverage for util.promisify
Browse files Browse the repository at this point in the history
Add a test that confirms that non-function arguments
passed to util.promisify throw an ERR_INVALID_ARG_TYPE
error.

PR-URL: #17591
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Ruben Bridgewater <[email protected]>
Reviewed-By: Rich Trott <[email protected]>
Reviewed-By: Jon Moss <[email protected]>
Reviewed-By: Michael Dawson <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
Reviewed-By: Gireesh Punathil <[email protected]>
Reviewed-By: Anatoli Papirovski <[email protected]>
  • Loading branch information
mithunsasidharan authored and MylesBorins committed Jan 8, 2018
1 parent 7008719 commit f16eca4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/parallel/test-util-promisify.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
});
});

0 comments on commit f16eca4

Please sign in to comment.