Skip to content

Commit cfa349b

Browse files
authored
test: include tests from methods not available in screen (#179)
1 parent b9eb9b0 commit cfa349b

File tree

2 files changed

+27
-3
lines changed

2 files changed

+27
-3
lines changed

docs/rules/prefer-screen-queries.md

+6
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,12 @@ const utils = render(<Foo />);
5454
utils.rerender(<Foo />);
5555
utils.unmount();
5656
utils.asFragment();
57+
58+
// the same functions, but called from destructuring
59+
const { rerender, unmount, asFragment } = render(<Foo />);
60+
rerender(<Foo />);
61+
asFragment();
62+
unmount();
5763
```
5864

5965
## Further Reading

tests/lib/rules/prefer-screen-queries.test.ts

+21-3
Original file line numberDiff line numberDiff line change
@@ -47,21 +47,39 @@ ruleTester.run(RULE_NAME, rule, {
4747
},
4848
{
4949
code: `
50-
const utils = render(baz);
51-
screen.rerender();
50+
const { rerender } = render(baz);
51+
rerender();
5252
`
5353
},
5454
{
5555
code: `
5656
const utils = render(baz);
57-
utils.unmount();
57+
utils.rerender();
5858
`
5959
},
6060
{
6161
code: `
6262
const utils = render(baz);
6363
utils.asFragment();
6464
`
65+
},
66+
{
67+
code: `
68+
const { asFragment } = render(baz);
69+
asFragment();
70+
`
71+
},
72+
{
73+
code: `
74+
const { unmount } = render(baz);
75+
unmount();
76+
`
77+
},
78+
{
79+
code: `
80+
const utils = render(baz);
81+
utils.unmount();
82+
`
6583
}
6684
],
6785

0 commit comments

Comments
 (0)