mirror of
https://github.com/callstack/react-native-testing-library.git
synced 2026-09-18 23:09:04 +08:00
feat: wrap render with act() for better React Hooks support (#122)
This commit is contained in:
committed by
Michał Pierzchała
parent
747e864369
commit
11489b0e5e
@@ -379,3 +379,7 @@ const { queryAllByText } = render(<Forms />);
|
||||
const submitButtons = queryAllByText('submit');
|
||||
expect(submitButtons).toHaveLength(3); // expect 3 elements
|
||||
```
|
||||
|
||||
## `act`
|
||||
|
||||
Useful function to help testing components that use hooks API. By default any `render` and `fireEvent` calls are wrapped by this function, so there is no need to wrap it manually. This method is re-exported from [`react-test-renderer`](https://github.com/facebook/react/blob/master/packages/react-test-renderer/src/ReactTestRenderer.js#L567]).
|
||||
|
||||
Reference in New Issue
Block a user