diff --git a/tests/ui/README.md b/tests/ui/README.md index d4cd11ce02f3..0dd7769dbefa 100644 --- a/tests/ui/README.md +++ b/tests/ui/README.md @@ -98,7 +98,7 @@ test('toggles state when clicked', () => { ### Don’ts - Don’t test implementation details (e.g., state variables or internal method calls). -- Don’t ignore warnings: Fix `act()` or other common warnings to ensure reliability. The `act()`function ensures that any updates to the state or props of a component (including rendering, firing events, or manual state updates) are completed before the test proceeds. The RNTL automatically wraps most rendering and interaction utilities (`render`, `fireEvent`, `waitFor`, etc.) in `act()` to manage these updates. However, there are some situations where manual use of `act()` might be necessary, particularly when dealing with asynchronous logic, animations or timers(`setTimeOut`, `setInterval` etc). You can find more detailed explanation [here](https://callstack.github.io/react-native-testing-library/docs/advanced/understanding-act). +- Don’t ignore warnings: Fix `act()` or other common warnings to ensure reliability. The `act()` function ensures that any updates to the state or props of a component (including rendering, firing events, or manual state updates) are completed before the test proceeds. The RNTL automatically wraps most rendering and interaction utilities (`render`, `fireEvent`, `waitFor`, etc.) in `act()` to manage these updates. However, there are some situations where manual use of `act()` might be necessary, particularly when dealing with asynchronous logic, animations or timers (`setTimeout`, `setInterval` etc). You can find more detailed explanation [here](https://callstack.github.io/react-native-testing-library/docs/advanced/understanding-act). - Avoid over-mocking: Mock dependencies sparingly to maintain realistic tests. - *Bad*: Mocking a child component unnecessarily. - *Good*: Mocking a network request while testing component interactions.