diff options
author | Casper Beyer <caspervonb@pm.me> | 2020-06-25 06:57:08 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-25 00:57:08 +0200 |
commit | 87f8f99c49e62c06f85bb453a7c12b32634c3bef (patch) | |
tree | e8f966f981a9f825ca1f22fe8d39642c448a9c62 /cli/tests/unit/text_encoding_test.ts | |
parent | 6bbe52fba33e440e113bca423b5eae0d1f320c49 (diff) |
refactor(cli/tests/unit) to use assertThrows (#6459)
Diffstat (limited to 'cli/tests/unit/text_encoding_test.ts')
-rw-r--r-- | cli/tests/unit/text_encoding_test.ts | 11 |
1 files changed, 3 insertions, 8 deletions
diff --git a/cli/tests/unit/text_encoding_test.ts b/cli/tests/unit/text_encoding_test.ts index 87b601f36..c87fc705d 100644 --- a/cli/tests/unit/text_encoding_test.ts +++ b/cli/tests/unit/text_encoding_test.ts @@ -1,5 +1,5 @@ // Copyright 2018-2020 the Deno authors. All rights reserved. MIT license. -import { unitTest, assert, assertEquals } from "./test_util.ts"; +import { unitTest, assert, assertEquals, assertThrows } from "./test_util.ts"; unitTest(function btoaSuccess(): void { const text = "hello world"; @@ -52,14 +52,9 @@ unitTest(function atobThrows2(): void { unitTest(function btoaFailed(): void { const text = "你好"; - let err; - try { + assertThrows(() => { btoa(text); - } catch (e) { - err = e; - } - assert(!!err); - assert(err instanceof TypeError); + }, TypeError); }); unitTest(function textDecoder2(): void { |