summaryrefslogtreecommitdiff
path: root/std/testing/asserts_test.ts
diff options
context:
space:
mode:
Diffstat (limited to 'std/testing/asserts_test.ts')
-rw-r--r--std/testing/asserts_test.ts24
1 files changed, 22 insertions, 2 deletions
diff --git a/std/testing/asserts_test.ts b/std/testing/asserts_test.ts
index c7fa5a737..c3059ebac 100644
--- a/std/testing/asserts_test.ts
+++ b/std/testing/asserts_test.ts
@@ -275,12 +275,12 @@ Deno.test("testingAssertFailWithWrongErrorClass", function (): void {
(): void => {
fail("foo");
},
- Error,
+ TypeError,
"Failed assertion: foo"
);
},
AssertionError,
- `Expected error to be instance of "Error", but was "AssertionError"`
+ `Expected error to be instance of "TypeError", but was "AssertionError"`
);
});
@@ -626,3 +626,23 @@ Deno.test("assert diff formatting", () => {
]`
);
});
+
+Deno.test("Assert Throws Parent Error", () => {
+ assertThrows(
+ () => {
+ throw new AssertionError("Fail!");
+ },
+ Error,
+ "Fail!"
+ );
+});
+
+Deno.test("Assert Throws Async Parent Error", () => {
+ assertThrowsAsync(
+ () => {
+ throw new AssertionError("Fail!");
+ },
+ Error,
+ "Fail!"
+ );
+});