mirror of
https://github.com/nodejs/node.git
synced 2025-05-07 12:03:30 +00:00

Split `test-whatwg-encoding-textdecoder-fatal.js` into - `test-whatwg-encoding-custom-textdecoder-fatal.js` which is a customized version of the WPT that tests for Node.js-specific error codes. - `test-whatwg-encoding-custom-textdecoder-invalid-arg` which tests `ERR_INVALID_ARG_TYPE` PR-URL: https://github.com/nodejs/node/pull/25155 Reviewed-By: James M Snell <jasnell@gmail.com>
19 lines
471 B
JavaScript
19 lines
471 B
JavaScript
'use strict';
|
|
|
|
// This tests that ERR_INVALID_ARG_TYPE are thrown when
|
|
// invalid arguments are passed to TextDecoder.
|
|
|
|
const common = require('../common');
|
|
|
|
{
|
|
const notArrayBufferViewExamples = [false, {}, 1, '', new Error()];
|
|
notArrayBufferViewExamples.forEach((invalidInputType) => {
|
|
common.expectsError(() => {
|
|
new TextDecoder(undefined, null).decode(invalidInputType);
|
|
}, {
|
|
code: 'ERR_INVALID_ARG_TYPE',
|
|
type: TypeError
|
|
});
|
|
});
|
|
}
|