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:
Leko 2017-12-18 16:07:39 +09:00 committed by Tobias Nießen
parent a3497b3e92
commit d50e1a2916
No known key found for this signature in database
GPG Key ID: 718207F8FD156B70

View File

@ -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(
() => {