Intended outcome:
Writing tests for final state or error state of components that have query inside (there was no difference in useQuery or Render Prop pattern)
Actual outcome:
Tests has been failed, because component stuck on loading state when returning any jsx element except <p> in loading state (loading if statement).
How to reproduce the issue:
https://codesandbox.io/embed/apollo-client-error-template-w5j1h
Run tests to see the problem.
Versions
System:
OS: Linux 4.15 Ubuntu 18.04.2 LTS (Bionic Beaver)
Binaries:
Node: 10.15.3 - ~/.nvm/versions/node/v10.15.3/bin/node
npm: 6.4.1 - ~/.nvm/versions/node/v10.15.3/bin/npm
Browsers:
Chrome: 72.0.3626.121
Firefox: 68.0.1
npmPackages:
apollo-cache-inmemory: ^1.5.1 => 1.6.2
apollo-client: ^2.6.3 => 2.6.3
apollo-link: ^1.2.11 => 1.2.12
apollo-link-context: ^1.0.17 => 1.0.18
apollo-link-error: ^1.1.10 => 1.1.11
apollo-link-http: ^1.5.14 => 1.5.15
apollo-link-schema: ^1.2.3 => 1.2.3
apollo-link-state: ^0.4.2 => 0.4.2
react-apollo: ^3.0.0 => 3.0.0
Just forked your sandbox and tried using react-testing-library instead of enzyme and all the tests seem to pass.
You can take a look here https://codesandbox.io/s/apollo-client-error-template-lzcdt?fontsize=14
Please try a recent version of @apollo/client and let us know if this issue is still happening. Thanks!