Skip to content

Commit 15db1b0

Browse files
Sunil Paialexkrolick
Sunil Pai
andauthored
Apply suggestions from code review
Thanks @alexkrolick! Co-Authored-By: Alex Krolick <[email protected]>
1 parent af258c6 commit 15db1b0

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

Diff for: content/docs/act.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,11 @@ title: act
44
permalink: docs/act.html
55
---
66

7-
Tests typically resemble the [arrange / act / assert design pattern](http://wiki.c2.com/?ArrangeActAssert). When writing UI tests, tasks like rendering, user events, or data fetching can be considered as 'units' of interaction with a user interface. `act()` provides an abstraction to grouping these actions, and making sure the rendering surface reflects a state where all these actions have been 'committed' (ie, the DOM has been updated). For example:
7+
`act()` provides an abstraction to make sure what's rendered reflects a state where pending actions have been 'committed' and the DOM has been updated. When writing UI tests, tasks like rendering, user events, or data fetching can be considered as 'units' of interaction with a user interface. `act` allows you be sure all effects related to a unit have been processed before asserting on the result.
8+
9+
Note: The name `act` comes from the `act` section of the [arrange-act-assert pattern](http://wiki.c2.com/?ArrangeActAssert).
10+
11+
For example:
812

913
```jsx
1014
import { render } from "react-dom";

Diff for: content/docs/testing-recipes.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ it("renders with or without a name", () => {
6666

6767
### Data fetching {#data-fetching}
6868

69-
Mocking data fetching with 'fake' data prevents flaky tests, and makes them run faster.
69+
Instead of calling real APIs in all your tests, you can mock requests with dummy data. Mocking data fetching with 'fake' data prevents flaky tests due to an unavailable backend, and makes them run faster. Note: you may still want to run a subset of tests using an "end-to-end" framework that tells whether the whole app is working together.
7070

7171
```jsx
7272
// user.js

0 commit comments

Comments
 (0)