@@ -13,12 +13,6 @@ elements in their tests rather than just use `getBy*` queries and expect
13
13
it doesn't throw an error so it's easier to understand what's the
14
14
expected behavior within the test.
15
15
16
- > ⚠️ Please note that this rule is recommended to be used together with
17
- > [ prefer-expect-query-by] ( docs/rules/prefer-expect-query-by.md ) , so the
18
- > combination of these two rules will force users to do 2 actual
19
- > changes: wrap ` getBy* ` with ` expect ` assertion and then use ` queryBy* `
20
- > instead of ` getBy* ` for asserting.
21
-
22
16
Examples of ** incorrect** code for this rule:
23
17
24
18
``` js
@@ -41,9 +35,6 @@ expect(getByText('foo')).toBeDefined();
41
35
const utils = render (< Component / > );
42
36
expect (utils .getByText (' foo' )).toBeDefined ();
43
37
44
- // ⚠️ `getBy*` should be replaced by `queryBy*` when combined with `prefer-expect-query-by` rule
45
- expect (queryByText (' foo' )).toBeDefined ();
46
-
47
38
// even more explicit if you use `@testing-library/jest-dom` matcher
48
39
// for checking the element is present in the document
49
40
expect (queryByText (' foo' )).toBeInTheDocument ();
@@ -74,10 +65,6 @@ This rule accepts a single options argument:
74
65
If you prefer to use ` getBy* ` queries implicitly as an assert-like
75
66
method itself, then this rule is not recommended.
76
67
77
- ## Related Rules
78
-
79
- - [ prefer-expect-query-by] ( prefer-expect-query-by.md )
80
-
81
68
## Further Reading
82
69
83
70
- [ getBy query] ( https://testing-library.com/docs/dom-testing-library/api-queries#getby )
0 commit comments