Open jakubszalek opened 2 years ago
Hi Jakub, I've updated the tests to use the MockedProvider, I still need to use findByText
for most of the current tests as the response is async and so will show the loading state until it resolves: https://www.apollographql.com/docs/react/development-testing/testing/#testing-the-loading-and-success-states
Och, you're right. You can also wrap all expects into await waitFor(() => {})
callback to avoid using async methods for getting elements.
Current implementation of mocks seems to be a bit too complicated and affects the standard way to describe test cases.
I'd suggest to try implement mocks using Apollo's MockedProvider. It's most recommended way of data mocking according to Apollo docs.
After switching it, it should be unnecessary to use async
findByText
method in test case.getByText
will be enough.