summaryrefslogtreecommitdiff
path: root/cli/tests/unit/buffer_test.ts
diff options
context:
space:
mode:
authorCasper Beyer <caspervonb@pm.me>2020-06-25 06:57:08 +0800
committerGitHub <noreply@github.com>2020-06-25 00:57:08 +0200
commit87f8f99c49e62c06f85bb453a7c12b32634c3bef (patch)
treee8f966f981a9f825ca1f22fe8d39642c448a9c62 /cli/tests/unit/buffer_test.ts
parent6bbe52fba33e440e113bca423b5eae0d1f320c49 (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.ts17
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> {