summaryrefslogtreecommitdiff
path: root/test/parallel/test-crypto-pbkdf2.js
diff options
context:
space:
mode:
authorJames M Snell <jasnell@gmail.com>2017-09-06 08:10:34 -0700
committerJames M Snell <jasnell@gmail.com>2017-09-18 08:10:59 -0700
commitc75f87cc4c8d3699e081d37bb5bf47a70d830fdb (patch)
tree9d79319f568ff43e36e05a8d2634130adfacfb74 /test/parallel/test-crypto-pbkdf2.js
parent8fa5fcc0ba74c23490c34da1a6c6e9a454280740 (diff)
downloadandroid-node-v8-c75f87cc4c8d3699e081d37bb5bf47a70d830fdb.tar.gz
android-node-v8-c75f87cc4c8d3699e081d37bb5bf47a70d830fdb.tar.bz2
android-node-v8-c75f87cc4c8d3699e081d37bb5bf47a70d830fdb.zip
crypto: refactor the crypto module
* Split single monolithic file into multiple * Make Certificate methods static * Allow randomFill(Sync) to use any ArrayBufferView * Use internal/errors throughout * Improve arg validation in Hash/Hmac * Doc updates PR-URL: https://github.com/nodejs/node/pull/15231 Reviewed-By: Michaƫl Zasso <targos@protonmail.com> Reviewed-By: Fedor Indutny <fedor.indutny@gmail.com>
Diffstat (limited to 'test/parallel/test-crypto-pbkdf2.js')
-rw-r--r--test/parallel/test-crypto-pbkdf2.js30
1 files changed, 21 insertions, 9 deletions
diff --git a/test/parallel/test-crypto-pbkdf2.js b/test/parallel/test-crypto-pbkdf2.js
index f8f4286525..c495b9306f 100644
--- a/test/parallel/test-crypto-pbkdf2.js
+++ b/test/parallel/test-crypto-pbkdf2.js
@@ -55,9 +55,13 @@ function ondone(err, key) {
}
// Error path should not leak memory (check with valgrind).
-assert.throws(function() {
- crypto.pbkdf2('password', 'salt', 1, 20, null);
-}, /^Error: No callback provided to pbkdf2$/);
+common.expectsError(
+ () => crypto.pbkdf2('password', 'salt', 1, 20, null),
+ {
+ code: 'ERR_INVALID_CALLBACK',
+ type: TypeError
+ }
+);
// Should not work with Infinity key length
assert.throws(function() {
@@ -95,10 +99,18 @@ assert.doesNotThrow(() => {
}));
});
-assert.throws(() => {
- crypto.pbkdf2('password', 'salt', 8, 8, common.mustNotCall());
-}, /^TypeError: The "digest" argument is required and must not be undefined$/);
+common.expectsError(
+ () => crypto.pbkdf2('password', 'salt', 8, 8, common.mustNotCall()),
+ {
+ code: 'ERR_INVALID_ARG_TYPE',
+ type: TypeError,
+ message: 'The "digest" argument must be one of type string or null'
+ });
-assert.throws(() => {
- crypto.pbkdf2Sync('password', 'salt', 8, 8);
-}, /^TypeError: The "digest" argument is required and must not be undefined$/);
+common.expectsError(
+ () => crypto.pbkdf2Sync('password', 'salt', 8, 8),
+ {
+ code: 'ERR_INVALID_ARG_TYPE',
+ type: TypeError,
+ message: 'The "digest" argument must be one of type string or null'
+ });