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
Is your feature request related to a problem? Please describe.
There's a few best practices we have been shirking on. First of all we should be using the screen.*By queries rather than using the const { findBy* } = render() to get elements and whatnot. We also shouldn't be using container to search for elements*. We should go through our test suites and clean up some of these inefficiencies.
*some conditions may apply
Describe the solution, feature, or improvement you'd like
Pulling some common mistakes we initially made from Kent C. Dodds article.
// From thisconst{ container, getByText }=render(<Table{...}/>);constrows=container.querySelectorAll('tbody > tr');constnextPageButton=getByText('Next page');// ...// To thisrender(<Table{...}/>);constrows=awaitscreen.findAllByRole('row');constnextPageButton=screen.getByRole('button',{name: /next page/i});// ....
Describe alternatives you've considered
N/A
Additional context
N/A
The text was updated successfully, but these errors were encountered:
Is your feature request related to a problem? Please describe.
There's a few best practices we have been shirking on. First of all we should be using the
screen.*By
queries rather than using theconst { findBy* } = render()
to get elements and whatnot. We also shouldn't be usingcontainer
to search for elements*. We should go through our test suites and clean up some of these inefficiencies.*some conditions may apply
Describe the solution, feature, or improvement you'd like
Pulling some common mistakes we initially made from Kent C. Dodds article.
Describe alternatives you've considered
N/A
Additional context
N/A
The text was updated successfully, but these errors were encountered: