summaryrefslogtreecommitdiff
path: root/test/parallel/test-string-decoder.js
diff options
context:
space:
mode:
authorBenjamin Chen <benjaminlchen@gmail.com>2018-08-14 02:10:17 -0400
committerAnna Henningsen <anna@addaleax.net>2018-08-24 19:56:17 +0200
commit5673017c33c96a20c39cd5deb70714a41267d029 (patch)
tree1de77942aae1eb80befcd4727426a626d1bf0842 /test/parallel/test-string-decoder.js
parent902fd40ed59035ee10c3637e32616ce7b858c9e2 (diff)
downloadnode-new-5673017c33c96a20c39cd5deb70714a41267d029.tar.gz
test: improve code coverage for string decoder
PR-URL: https://github.com/nodejs/node/pull/22306 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Diffstat (limited to 'test/parallel/test-string-decoder.js')
-rw-r--r--test/parallel/test-string-decoder.js10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/parallel/test-string-decoder.js b/test/parallel/test-string-decoder.js
index fafab97b2d..5571aaeeb7 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