summaryrefslogtreecommitdiff
path: root/cli/tests/unit/text_encoding_test.ts
diff options
context:
space:
mode:
authorLeonard Ginters <leonard@linters.de>2020-10-19 23:56:29 +0200
committerGitHub <noreply@github.com>2020-10-19 23:56:29 +0200
commit623ac9e6df660b758aa3da281b6ff2b4db265ef0 (patch)
tree09749c4a1189d5b1a9edd95e5cf42d7248e2d2dc /cli/tests/unit/text_encoding_test.ts
parent1474d5d76d38c094c6c551bcd23a61f8328bb258 (diff)
fix(op_crates/web): TextEncoder should throw RangeError (#8039)
This commit changes error type thrown by TextEncoder, when provided encoding is not supported matching Chromium behavior.
Diffstat (limited to 'cli/tests/unit/text_encoding_test.ts')
-rw-r--r--cli/tests/unit/text_encoding_test.ts11
1 files changed, 11 insertions, 0 deletions
diff --git a/cli/tests/unit/text_encoding_test.ts b/cli/tests/unit/text_encoding_test.ts
index 23799fba3..6a9274d02 100644
--- a/cli/tests/unit/text_encoding_test.ts
+++ b/cli/tests/unit/text_encoding_test.ts
@@ -112,6 +112,17 @@ unitTest(function textDecoderErrorEncoding(): void {
assert(didThrow);
});
+unitTest(function textDecoderHandlesNotFoundInternalDecoder() {
+ let didThrow = false;
+ try {
+ new TextDecoder("gbk");
+ } catch (e) {
+ didThrow = true;
+ assert(e instanceof RangeError);
+ }
+ assert(didThrow);
+});
+
unitTest(function textEncoder(): void {
const fixture = "𝓽𝓮𝔁𝓽";
const encoder = new TextEncoder();