From 5673017c33c96a20c39cd5deb70714a41267d029 Mon Sep 17 00:00:00 2001 From: Benjamin Chen Date: Tue, 14 Aug 2018 02:10:17 -0400 Subject: [PATCH] test: improve code coverage for string decoder PR-URL: https://github.com/nodejs/node/pull/22306 Reviewed-By: Colin Ihrig Reviewed-By: Trivikram Kamat Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater Reviewed-By: Luigi Pinca --- test/parallel/test-string-decoder.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/test/parallel/test-string-decoder.js b/test/parallel/test-string-decoder.js index fafab97b2d3..5571aaeeb78 100644 --- a/test/parallel/test-string-decoder.js +++ b/test/parallel/test-string-decoder.js @@ -161,6 +161,16 @@ common.expectsError( } ); +common.expectsError( + () => new StringDecoder('utf8').write(null), + { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError, + message: 'The "buf" argument must be one of type Buffer, Uint8Array, or' + + ' ArrayBufferView. Received type object' + } +); + // test verifies that StringDecoder will correctly decode the given input // buffer with the given encoding to the expected output. It will attempt all // possible ways to write() the input buffer, see writeSequences(). The