Closed
Description
Example code before running the linter
const { getByText } = render(<Foo />)
await waitFor(() => getByText('foo'))
After automatically fixing this, the code looks like this
const { getByText } = render(<Foo />)
await findByText('foo')
There are a couple of issues:
- As the title mentions,
findByText
is not defined. If the code was usingscreen
or any similar wrapper, instead of the bound function directly, this is not a problem. - If
getByText
is not used elsewhere, it becomes unused, causing another error in the linter that wasn't there before - we've introduced this error - Something similar might happen with
waitFor
- it might now be unused as well
We should definitely fix 1. as it otherwise it's a broken code. I guess I could track where getByText
was defined, and add the findBy*
function there.
Thoughts on 2. and 3 ?