Skip to content

Commit

Permalink
docs: added link to assertion count section in assertion page
Browse files Browse the repository at this point in the history
  • Loading branch information
DevMoustafa97 committed Aug 27, 2024
1 parent bd1c6db commit 2522a20
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions docs/TestingAsyncCode.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ test('the data is peanut butter', () => {

## Async/Await

Alternatively, you can use `async` and `await` in your tests. To write an async test, use the `async` keyword in front of the function passed to `test`. For example, the same `fetchData` scenario can be tested with:
If you expect a promise to be rejected, use the `.catch` method. Make sure to add `expect.assertions` to verify that a certain number of [assertions](ExpectAPI.md#assertion-count) are called. Otherwise, a fulfilled promise would not fail the test.

```js
test('the data is peanut butter', async () => {
Expand Down Expand Up @@ -59,7 +59,7 @@ Be sure to return (or `await`) the promise - if you omit the `return`/`await` st

:::

If you expect a promise to be rejected, use the `.catch` method. Make sure to add `expect.assertions` to verify that a certain number of assertions are called. Otherwise, a fulfilled promise would not fail the test.
If you expect a promise to be rejected, use the `.catch` method. Make sure to add `expect.assertions` to verify that a certain number of [assertions](ExpectAPI.md#assertion-count) are called. Otherwise, a fulfilled promise would not fail the test.

```js
test('the fetch fails with an error', () => {
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-29.4/TestingAsyncCode.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Be sure to return (or `await`) the promise - if you omit the `return`/`await` st

:::

If you expect a promise to be rejected, use the `.catch` method. Make sure to add `expect.assertions` to verify that a certain number of assertions are called. Otherwise, a fulfilled promise would not fail the test.
If you expect a promise to be rejected, use the `.catch` method. Make sure to add `expect.assertions` to verify that a certain number of [assertions](ExpectAPI.md#assertion-count) are called. Otherwise, a fulfilled promise would not fail the test.

```js
test('the fetch fails with an error', () => {
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-29.5/TestingAsyncCode.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Be sure to return (or `await`) the promise - if you omit the `return`/`await` st

:::

If you expect a promise to be rejected, use the `.catch` method. Make sure to add `expect.assertions` to verify that a certain number of assertions are called. Otherwise, a fulfilled promise would not fail the test.
If you expect a promise to be rejected, use the `.catch` method. Make sure to add `expect.assertions` to verify that a certain number of [assertions](ExpectAPI.md#assertion-count) are called. Otherwise, a fulfilled promise would not fail the test.

```js
test('the fetch fails with an error', () => {
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-29.6/TestingAsyncCode.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Be sure to return (or `await`) the promise - if you omit the `return`/`await` st

:::

If you expect a promise to be rejected, use the `.catch` method. Make sure to add `expect.assertions` to verify that a certain number of assertions are called. Otherwise, a fulfilled promise would not fail the test.
If you expect a promise to be rejected, use the `.catch` method. Make sure to add `expect.assertions` to verify that a certain number of [assertions](ExpectAPI.md#assertion-count) are called. Otherwise, a fulfilled promise would not fail the test.

```js
test('the fetch fails with an error', () => {
Expand Down
2 changes: 1 addition & 1 deletion website/versioned_docs/version-29.7/TestingAsyncCode.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ Be sure to return (or `await`) the promise - if you omit the `return`/`await` st

:::

If you expect a promise to be rejected, use the `.catch` method. Make sure to add `expect.assertions` to verify that a certain number of assertions are called. Otherwise, a fulfilled promise would not fail the test.
If you expect a promise to be rejected, use the `.catch` method. Make sure to add `expect.assertions` to verify that a certain number of [assertions](ExpectAPI.md#assertion-count) are called. Otherwise, a fulfilled promise would not fail the test.

```js
test('the fetch fails with an error', () => {
Expand Down

0 comments on commit 2522a20

Please sign in to comment.