-
Notifications
You must be signed in to change notification settings - Fork 30k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: split test-whatwg-encoding-textdecoder-fatal.js
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: #25155 Reviewed-By: James M Snell <[email protected]>
- Loading branch information
1 parent
a8f5191
commit deceb26
Showing
2 changed files
with
20 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
test/parallel/test-whatwg-encoding-custom-textdecoder-invalid-arg.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'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 | ||
}); | ||
}); | ||
} |