Skip to content

Commit 1790569

Browse files
committed
test: improve test coverage for WHATWG TextDecoder
Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com> PR-URL: #45241 Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 6317502 commit 1790569

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

test/parallel/test-whatwg-encoding-custom-textdecoder.js

+13
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,19 @@ assert(TextDecoder);
5151
});
5252
}
5353

54+
// Invalid encoders
55+
{
56+
['meow', 'nonunicode', 'foo', 'bar'].forEach((fakeEncoding) => {
57+
assert.throws(
58+
() => { new TextDecoder(fakeEncoding); },
59+
{
60+
code: 'ERR_ENCODING_NOT_SUPPORTED',
61+
name: 'RangeError'
62+
}
63+
);
64+
});
65+
}
66+
5467
// Test TextDecoder, UTF-8, fatal: true, ignoreBOM: false
5568
if (common.hasIntl) {
5669
['unicode-1-1-utf-8', 'utf8', 'utf-8'].forEach((i) => {

0 commit comments

Comments
 (0)