You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/docs/14.x/docs/guides/common-mistakes.mdx
+9-9Lines changed: 9 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -10,7 +10,7 @@ This guide outlines some common mistakes people make when using React Native Tes
10
10
11
11
## Not using Testing Library ESLint plugins {#not-using-testing-library-eslint-plugins}
12
12
13
-
**Importance: high**
13
+
**Importance: medium**
14
14
15
15
There's an ESLint plugin for Testing Library: [`eslint-plugin-testing-library`](https://github.com/testing-library/eslint-plugin-testing-library). This plugin can help you avoid common mistakes and will automatically fix your code in many cases.
16
16
@@ -57,7 +57,7 @@ This works fine, but it's more conventional to name it something more descriptiv
57
57
58
58
## Using cleanup {#using-cleanup}
59
59
60
-
**Importance: low**
60
+
**Importance: medium**
61
61
62
62
React Native Testing Library automatically cleans up after each test. You don't need to call `cleanup()` manually unless you're using the `pure` export (which doesn't include automatic cleanup).
63
63
@@ -121,7 +121,7 @@ Using `screen` has several benefits:
121
121
122
122
## Using the wrong assertion {#using-the-wrong-assertion}
123
123
124
-
**Importance: medium**
124
+
**Importance: high**
125
125
126
126
React Native Testing Library provides built-in Jest matchers. Make sure you're using the right ones:
127
127
@@ -332,7 +332,7 @@ Note: React Native supports both ARIA-compatible (`role`) and traditional (`acce
332
332
333
333
## Adding aria-, role, and other accessibility attributes incorrectly {#adding-aria-role-and-other-accessibility-attributes-incorrectly}
334
334
335
-
**Importance: medium**
335
+
**Importance: high**
336
336
337
337
React Native supports ARIA-compatible attributes. Use them correctly:
## Having multiple assertions in a single waitFor callback {#having-multiple-assertions-in-a-single-waitfor-callback}
511
511
512
-
**Importance: medium**
512
+
**Importance: low**
513
513
514
514
Keep `waitFor` callbacks focused on a single assertion:
515
515
@@ -593,7 +593,7 @@ test('avoids side effects in waitFor', async () => {
593
593
594
594
## Using get\* variants as assertions {#using-get-variants-as-assertions}
595
595
596
-
**Importance: medium**
596
+
**Importance: low**
597
597
598
598
`getBy*` queries throw errors when elements aren't found, so they work as assertions. However, for better error messages, you might want to combine them with explicit matchers:
0 commit comments