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/buffer_test.ts | |
| parent | 6bbe52fba33e440e113bca423b5eae0d1f320c49 (diff) | |
refactor(cli/tests/unit) to use assertThrows (#6459)
Diffstat (limited to 'cli/tests/unit/buffer_test.ts')
| -rw-r--r-- | cli/tests/unit/buffer_test.ts | 17 |
1 files changed, 7 insertions, 10 deletions
diff --git a/cli/tests/unit/buffer_test.ts b/cli/tests/unit/buffer_test.ts index c5a63b5c8..644f05952 100644 --- a/cli/tests/unit/buffer_test.ts +++ b/cli/tests/unit/buffer_test.ts @@ -6,7 +6,6 @@ import { assertEquals, assert, - assertStringContains, assertThrows, assertThrowsAsync, unitTest, @@ -159,15 +158,13 @@ unitTest(async function bufferTooLargeByteWrites(): Promise<void> { const buf = new Deno.Buffer(xBytes.buffer as ArrayBuffer); await buf.read(tmp); - let err; - try { - buf.grow(growLen); - } catch (e) { - err = e; - } - - assert(err instanceof Error); - assertStringContains(err.message, "grown beyond the maximum size"); + assertThrows( + () => { + buf.grow(growLen); + }, + Error, + "grown beyond the maximum size" + ); }); unitTest(async function bufferLargeByteReads(): Promise<void> { |
