From 5d678b0b8e8be1c94dfd205f951dfb5793f03a58 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 --- 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 fafab97b2d3888..5571aaeeb78dc2 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