Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
test: add a test of _pbkdf2 where keylen is not a number
  • Loading branch information
Leko committed Dec 18, 2017
commit ae974c7c059c5ef478161a240c51bcc82948a4d5
11 changes: 11 additions & 0 deletions test/parallel/test-crypto-pbkdf2.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,17 @@ common.expectsError(
}
);

['str', null, undefined, [], {}].forEach((i) => {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small nit: please use a more descriptive variable name than i.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for your review.
I renamed i to notNumber.

common.expectsError(
() => {
crypto.pbkdf2Sync('password', 'salt', 1, i, '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(
() => {
Expand Down