Skip to content

Commit 9da7a2d

Browse files
committed
test: improve test coverage for WHATWG TextDecoder
Signed-off-by: Juan José Arboleda <[email protected]>
1 parent cca44bc commit 9da7a2d

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

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

+14
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,20 @@ 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+
message: new RegExp(`The "${fakeEncoding}" encoding is not supported`)
63+
}
64+
);
65+
});
66+
}
67+
5468
// Test TextDecoder, UTF-8, fatal: true, ignoreBOM: false
5569
if (common.hasIntl) {
5670
['unicode-1-1-utf-8', 'utf8', 'utf-8'].forEach((i) => {

0 commit comments

Comments
 (0)