Skip to content

Commit

Permalink
docs: link to assertThrows() and assertRejects()
Browse files Browse the repository at this point in the history
  • Loading branch information
iuioiua committed Feb 26, 2024
1 parent ce719de commit 1adf5f3
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions assert/assert_rejects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ import { assertIsError } from "./assert_is_error.ts";
/**
* Executes a function which returns a promise, expecting it to reject.
*
* To assert that a synchronous function throws, use {@linkcode assertThrows}.
*
* @example
* ```ts
* import { assertRejects } from "https://deno.land/std@$STD_VERSION/assert/assert_rejects.ts";
Expand All @@ -22,6 +24,8 @@ export function assertRejects(
* If it does not, then it throws. An error class and a string that should be
* included in the error message can also be asserted.
*
* To assert that a synchronous function throws, use {@linkcode assertThrows}.
*
* @example
* ```ts
* import { assertRejects } from "https://deno.land/std@$STD_VERSION/assert/assert_rejects.ts";
Expand Down
6 changes: 6 additions & 0 deletions assert/assert_throws.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ import { AssertionError } from "./assertion_error.ts";
* Executes a function, expecting it to throw. If it does not, then it
* throws.
*
* To assert that an asynchronous function rejects, use
* {@linkcode assertRejects}.
*
* @example
* ```ts
* import { assertThrows } from "https://deno.land/std@$STD_VERSION/assert/assert_throws.ts";
Expand All @@ -23,6 +26,9 @@ export function assertThrows(
* throws. An error class and a string that should be included in the
* error message can also be asserted.
*
* To assert that an asynchronous function rejects, use
* {@linkcode assertRejects}.
*
* @example
* ```ts
* import { assertThrows } from "https://deno.land/std@$STD_VERSION/assert/assert_throws.ts";
Expand Down

0 comments on commit 1adf5f3

Please sign in to comment.