diff --git a/test/parallel/test-whatwg-encoding-textdecoder-fatal.js b/test/parallel/test-whatwg-encoding-textdecoder-fatal.js index be37f5097c504e..aa945b61b10e72 100644 --- a/test/parallel/test-whatwg-encoding-textdecoder-fatal.js +++ b/test/parallel/test-whatwg-encoding-textdecoder-fatal.js @@ -88,3 +88,15 @@ bad.forEach((t) => { assert(!new TextDecoder().fatal); assert(new TextDecoder('utf-8', { fatal: true }).fatal); } + +{ + const notArrayBufferViewExamples = [false, {}, 1, '', new Error()]; + notArrayBufferViewExamples.forEach((invalidInputType) => { + common.expectsError(() => { + new TextDecoder(undefined, null).decode(invalidInputType); + }, { + code: 'ERR_INVALID_ARG_TYPE', + type: TypeError + }); + }); +} diff --git a/test/parallel/test-whatwg-encoding-textdecoder.js b/test/parallel/test-whatwg-encoding-textdecoder.js index 37fbe12757134e..6d1db2ec33faad 100644 --- a/test/parallel/test-whatwg-encoding-textdecoder.js +++ b/test/parallel/test-whatwg-encoding-textdecoder.js @@ -75,6 +75,14 @@ if (common.hasIntl) { }); } +// Test TextDecoder, label undefined, options null +{ + const dec = new TextDecoder(undefined, null); + assert.strictEqual(dec.encoding, 'utf-8'); + assert.strictEqual(dec.fatal, false); + assert.strictEqual(dec.ignoreBOM, false); +} + // Test TextDecoder, UTF-16le { const dec = new TextDecoder('utf-16le');