diff --git a/test/parallel/test-whatwg-encoding-custom-textdecoder.js b/test/parallel/test-whatwg-encoding-custom-textdecoder.js index a48d0993fc7a92..e4379aa03f870d 100644 --- a/test/parallel/test-whatwg-encoding-custom-textdecoder.js +++ b/test/parallel/test-whatwg-encoding-custom-textdecoder.js @@ -51,6 +51,19 @@ assert(TextDecoder); }); } +// Invalid encoders +{ + ['meow', 'nonunicode', 'foo', 'bar'].forEach((fakeEncoding) => { + assert.throws( + () => { new TextDecoder(fakeEncoding); }, + { + code: 'ERR_ENCODING_NOT_SUPPORTED', + name: 'RangeError' + } + ); + }); +} + // Test TextDecoder, UTF-8, fatal: true, ignoreBOM: false if (common.hasIntl) { ['unicode-1-1-utf-8', 'utf8', 'utf-8'].forEach((i) => {