summaryrefslogtreecommitdiff
path: root/test/parallel/test-crypto-pbkdf2.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/parallel/test-crypto-pbkdf2.js')
-rw-r--r--test/parallel/test-crypto-pbkdf2.js37
1 files changed, 19 insertions, 18 deletions
diff --git a/test/parallel/test-crypto-pbkdf2.js b/test/parallel/test-crypto-pbkdf2.js
index c72551016d..d3f02cf8bd 100644
--- a/test/parallel/test-crypto-pbkdf2.js
+++ b/test/parallel/test-crypto-pbkdf2.js
@@ -82,7 +82,8 @@ common.expectsError(
}, {
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError,
- message: 'The "keylen" argument must be of type number'
+ message: 'The "keylen" argument must be of type number. ' +
+ `Received type ${typeof notNumber}`
});
});
@@ -107,7 +108,8 @@ common.expectsError(
{
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError,
- message: 'The "digest" argument must be one of type string or null'
+ message: 'The "digest" argument must be one of type string or null. ' +
+ 'Received type undefined'
});
common.expectsError(
@@ -115,58 +117,57 @@ common.expectsError(
{
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError,
- message: 'The "digest" argument must be one of type string or null'
+ message: 'The "digest" argument must be one of type string or null. ' +
+ 'Received type undefined'
});
-[1, {}, [], true, undefined, null].forEach((i) => {
+[1, {}, [], true, undefined, null].forEach((input) => {
+ const msgPart2 = `Buffer, or TypedArray. Received type ${typeof input}`;
common.expectsError(
- () => crypto.pbkdf2(i, 'salt', 8, 8, 'sha256', common.mustNotCall()),
+ () => crypto.pbkdf2(input, 'salt', 8, 8, 'sha256', common.mustNotCall()),
{
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError,
- message: 'The "password" argument must be one of type string, ' +
- 'Buffer, or TypedArray'
+ message: `The "password" argument must be one of type string, ${msgPart2}`
}
);
common.expectsError(
- () => crypto.pbkdf2('pass', i, 8, 8, 'sha256', common.mustNotCall()),
+ () => crypto.pbkdf2('pass', input, 8, 8, 'sha256', common.mustNotCall()),
{
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError,
- message: 'The "salt" argument must be one of type string, ' +
- 'Buffer, or TypedArray'
+ message: `The "salt" argument must be one of type string, ${msgPart2}`
}
);
common.expectsError(
- () => crypto.pbkdf2Sync(i, 'salt', 8, 8, 'sha256'),
+ () => crypto.pbkdf2Sync(input, 'salt', 8, 8, 'sha256'),
{
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError,
- message: 'The "password" argument must be one of type string, ' +
- 'Buffer, or TypedArray'
+ message: `The "password" argument must be one of type string, ${msgPart2}`
}
);
common.expectsError(
- () => crypto.pbkdf2Sync('pass', i, 8, 8, 'sha256'),
+ () => crypto.pbkdf2Sync('pass', input, 8, 8, 'sha256'),
{
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError,
- message: 'The "salt" argument must be one of type string, ' +
- 'Buffer, or TypedArray'
+ message: `The "salt" argument must be one of type string, ${msgPart2}`
}
);
});
['test', {}, [], true, undefined, null].forEach((i) => {
+ const received = `Received type ${typeof i}`;
common.expectsError(
() => crypto.pbkdf2('pass', 'salt', i, 8, 'sha256', common.mustNotCall()),
{
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError,
- message: 'The "iterations" argument must be of type number'
+ message: `The "iterations" argument must be of type number. ${received}`
}
);
@@ -175,7 +176,7 @@ common.expectsError(
{
code: 'ERR_INVALID_ARG_TYPE',
type: TypeError,
- message: 'The "iterations" argument must be of type number'
+ message: `The "iterations" argument must be of type number. ${received}`
}
);
});