Skip to content

Commit 4f9205e

Browse files
committed
Added basic cleanup and act usage docs
1 parent 18c3c8b commit 4f9205e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

README.md

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,9 +130,8 @@ Renders a test component that will call the provided `callback`, including any h
130130
#### Arguments
131131

132132
- `callback` (`function()`) - function to call each render. This function should call one or more hooks for testing.
133-
- `options` (`object`):
133+
- `options` (`object`) - accepts the [same options as `react-testing-library`'s `render` function](https://testing-library.com/docs/react-testing-library/api#render-options), as well as:
134134
- `initialProps` (`object`) - the initial values to pass to the `callback` function
135-
- `wrapper` (`Component`) - A component to wrap the underlying test component, commonly used to add context providers for the `useContext` hook. The component will recieve the test component as `children` and must render it.
136135

137136
#### Returns
138137

@@ -141,6 +140,16 @@ Renders a test component that will call the provided `callback`, including any h
141140
- `rerender` (`function([newProps])`) - function to rerender the test component including any hooks called in the `callback` function. If `newProps` are passed, the will replace the `initialProps` passed the the `callback` function for future renders.
142141
- `unmount` (`function()`) - function to unmount the test component, commonly used to trigger cleanup effects for `useEffect` hooks.
143142

143+
### `cleanup()`
144+
145+
Unmounts any React trees that were mounted with [renderHook](#renderhookcallback-options).
146+
147+
This is the same [`cleanup` function](https://testing-library.com/docs/react-testing-library/api#cleanup) that is exported by `react-testing-library`.
148+
149+
### `act(callback)`
150+
151+
This is the same [`act` function](https://testing-library.com/docs/react-testing-library/api#act) that is exported by `react-testing-library`.
152+
144153
## Contributors
145154

146155
Thanks goes to these wonderful people ([emoji key](https://github.com/kentcdodds/all-contributors#emoji-key)):

0 commit comments

Comments
 (0)