diff --git a/test/parallel/test-whatwg-encoding-textdecoder-fatal.js b/test/parallel/test-whatwg-encoding-textdecoder-fatal.js index cfb595e78e6b40..6d0ed1ef842d37 100644 --- a/test/parallel/test-whatwg-encoding-textdecoder-fatal.js +++ b/test/parallel/test-whatwg-encoding-textdecoder-fatal.js @@ -91,3 +91,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 e87364de1e91f7..10f2c8ea0197e8 100644 --- a/test/parallel/test-whatwg-encoding-textdecoder.js +++ b/test/parallel/test-whatwg-encoding-textdecoder.js @@ -76,6 +76,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');