summaryrefslogtreecommitdiff
path: root/std/testing/asserts_test.ts
diff options
context:
space:
mode:
authorJon Short <JonShort@users.noreply.github.com>2020-06-04 15:43:05 +0100
committerGitHub <noreply@github.com>2020-06-04 10:43:05 -0400
commit4b1638dccc601ff0282172c7e3ef0f1126a603ed (patch)
treeb6846d0be55adf568febe2cf1f89e173cc25e918 /std/testing/asserts_test.ts
parente3cc3db20fc86d9adb19bb472e8c96ae5f7c77c0 (diff)
feat(std/testing): Allow non-void promises in assertThrowsAsync (#6052)
Diffstat (limited to 'std/testing/asserts_test.ts')
-rw-r--r--std/testing/asserts_test.ts15
1 files changed, 15 insertions, 0 deletions
diff --git a/std/testing/asserts_test.ts b/std/testing/asserts_test.ts
index c333d41da..3969cd661 100644
--- a/std/testing/asserts_test.ts
+++ b/std/testing/asserts_test.ts
@@ -9,6 +9,7 @@ import {
assertEquals,
assertStrictEq,
assertThrows,
+ assertThrowsAsync,
AssertionError,
equal,
fail,
@@ -245,6 +246,20 @@ test("testingAssertFailWithWrongErrorClass", function (): void {
);
});
+test("testingAssertThrowsWithReturnType", () => {
+ assertThrows(() => {
+ throw new Error();
+ return "a string";
+ });
+});
+
+test("testingAssertThrowsAsyncWithReturnType", () => {
+ assertThrowsAsync(() => {
+ throw new Error();
+ return Promise.resolve("a Promise<string>");
+ });
+});
+
const createHeader = (): string[] => [
"",
"",