test: increase pbkdf2 test coverage
PR-URL: https://github.com/nodejs/node/pull/17730 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Tobias Nießen <tniessen@tnie.de> Reviewed-By: Jon Moss <me@jonathanmoss.me>
This commit is contained in:
parent
a3497b3e92
commit
d50e1a2916
@ -65,6 +65,26 @@ common.expectsError(
|
||||
}
|
||||
);
|
||||
|
||||
common.expectsError(
|
||||
() => crypto.pbkdf2Sync('password', 'salt', -1, 20, null),
|
||||
{
|
||||
code: 'ERR_OUT_OF_RANGE',
|
||||
type: RangeError,
|
||||
message: 'The "iterations" argument is out of range'
|
||||
}
|
||||
);
|
||||
|
||||
['str', null, undefined, [], {}].forEach((notNumber) => {
|
||||
common.expectsError(
|
||||
() => {
|
||||
crypto.pbkdf2Sync('password', 'salt', 1, notNumber, 'sha256');
|
||||
}, {
|
||||
code: 'ERR_INVALID_ARG_TYPE',
|
||||
type: TypeError,
|
||||
message: 'The "keylen" argument must be of type number'
|
||||
});
|
||||
});
|
||||
|
||||
[Infinity, -Infinity, NaN, -1, 4073741824, INT_MAX + 1].forEach((i) => {
|
||||
common.expectsError(
|
||||
() => {
|
||||
|
Loading…
x
Reference in New Issue
Block a user