I see a common pattern in RTL to check if the element is in the body directly after a get query.
test('render Hello World', () => { render(<App />); const hello = screen.getByText('Hello World'); expect(hello).toBeInTheDocument(); }); Isn't it redundant?
From documentation it states get queries will throw error if not found.
Will there be ever any case where get succeeds but element is not in document?
https://stackoverflow.com/questions/67294060/rtl-getby-method-followed-by-tobeindocument April 28, 2021 at 01:06PM
没有评论:
发表评论