summaryrefslogtreecommitdiff
path: root/cli/tests/unit/text_encoding_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'cli/tests/unit/text_encoding_test.ts')
-rw-r--r--cli/tests/unit/text_encoding_test.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/cli/tests/unit/text_encoding_test.ts b/cli/tests/unit/text_encoding_test.ts
index 5ae64cbce..4b7f75232 100644
--- a/cli/tests/unit/text_encoding_test.ts
+++ b/cli/tests/unit/text_encoding_test.ts
@@ -50,6 +50,21 @@ unitTest(function atobThrows2(): void {
assert(threw);
});
+unitTest(function atobThrows3(): void {
+ let threw = false;
+ try {
+ atob("foobar!!");
+ } catch (e) {
+ if (
+ e instanceof DOMException &&
+ e.toString().startsWith("InvalidCharacterError:")
+ ) {
+ threw = true;
+ }
+ }
+ assert(threw);
+});
+
unitTest(function btoaFailed(): void {
const text = "你好";
assertThrows(() => {