11cb0ef41Sopenharmony_ci'use strict'; 21cb0ef41Sopenharmony_ci 31cb0ef41Sopenharmony_ci// This tests that ERR_INVALID_ARG_TYPE are thrown when 41cb0ef41Sopenharmony_ci// invalid arguments are passed to TextDecoder. 51cb0ef41Sopenharmony_ci 61cb0ef41Sopenharmony_cirequire('../common'); 71cb0ef41Sopenharmony_ciconst assert = require('assert'); 81cb0ef41Sopenharmony_ci 91cb0ef41Sopenharmony_ci{ 101cb0ef41Sopenharmony_ci const notArrayBufferViewExamples = [false, {}, 1, '', new Error()]; 111cb0ef41Sopenharmony_ci notArrayBufferViewExamples.forEach((invalidInputType) => { 121cb0ef41Sopenharmony_ci assert.throws(() => { 131cb0ef41Sopenharmony_ci new TextDecoder(undefined, null).decode(invalidInputType); 141cb0ef41Sopenharmony_ci }, { 151cb0ef41Sopenharmony_ci code: 'ERR_INVALID_ARG_TYPE', 161cb0ef41Sopenharmony_ci name: 'TypeError' 171cb0ef41Sopenharmony_ci }); 181cb0ef41Sopenharmony_ci }); 191cb0ef41Sopenharmony_ci} 20