Skip to content

Commit

Permalink
test: improve test coverage for WHATWG TextDecoder
Browse files Browse the repository at this point in the history
Signed-off-by: Juan José Arboleda <soyjuanarbol@gmail.com>
  • Loading branch information
juanarbol committed Oct 30, 2022
1 parent cca44bc commit 9da7a2d
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions test/parallel/test-whatwg-encoding-custom-textdecoder.js
Expand Up @@ -51,6 +51,20 @@ assert(TextDecoder);
});
}

// Invalid encoders
{
['meow', 'nonunicode', 'foo', 'bar'].forEach((fakeEncoding) => {
assert.throws(
() => { new TextDecoder(fakeEncoding); },
{
code: 'ERR_ENCODING_NOT_SUPPORTED',
name: 'RangeError',
message: new RegExp(`The "${fakeEncoding}" encoding is not supported`)
}
);
});
}

// Test TextDecoder, UTF-8, fatal: true, ignoreBOM: false
if (common.hasIntl) {
['unicode-1-1-utf-8', 'utf8', 'utf-8'].forEach((i) => {
Expand Down

0 comments on commit 9da7a2d

Please sign in to comment.