From e0a3d741352001d3254adc290763b1bdcbad3ad3 Mon Sep 17 00:00:00 2001 From: Amit Zur Date: Wed, 16 Jan 2019 13:04:14 +0200 Subject: crypto: include 'Buffer' in error output of Hash.update method Fixes: https://github.com/nodejs/node/issues/25487 PR-URL: https://github.com/nodejs/node/pull/25533 Reviewed-By: Sakthipriyan Vairamani Reviewed-By: Sam Roberts Reviewed-By: James M Snell Reviewed-By: Anna Henningsen Reviewed-By: Benjamin Gruenbaum --- test/parallel/test-crypto-hash.js | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test') diff --git a/test/parallel/test-crypto-hash.js b/test/parallel/test-crypto-hash.js index 5cc622b48c..60904cf08f 100644 --- a/test/parallel/test-crypto-hash.js +++ b/test/parallel/test-crypto-hash.js @@ -122,6 +122,17 @@ common.expectsError( message: 'boom' }); +// Issue https://github.com/nodejs/node/issues/25487: error message for invalid +// arg type to update method should include all possible types +common.expectsError( + () => crypto.createHash('sha256').update(), + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError, + message: 'The "data" argument must be one of type string, Buffer, ' + + 'TypedArray, or DataView. Received type undefined' + }); + // Default UTF-8 encoding const hutf8 = crypto.createHash('sha512').update('УТФ-8 text').digest('hex'); assert.strictEqual( -- cgit v1.2.3