trojanowski / react-apollo-hooks

Use Apollo Client as React hooks
MIT License
2.41k stars 109 forks source link

Error: Network error: No more mocked responses for the query #167

Open viniciusavieira opened 5 years ago

viniciusavieira commented 5 years ago

Hello.

I've been using this project in a production level and things have gone good so far. But I've stuck into some problems when I try to write tests to a simple component.

I've followed the example in the docs, and I've setup a codesandbox to display my problem. Basically my querie mock always get the same error and never return the data.

https://codesandbox.io/s/apollomockstest-cwt57

image

jzabala commented 5 years ago

Hi @viniciusavieira

You test was failing because the query in the test and the query in the component was different. Check this one: https://codesandbox.io/embed/apollomockstest-rj3pm.

You test is still failing but because of you asserting now..

Jaman-dedy commented 5 years ago

Thanks so much @jzabala , this save my day

redreceipt commented 4 years ago

this is my query

Screen Shot 2019-11-12 at 10 54 40 AM

this is my mock

Screen Shot 2019-11-12 at 10 54 56 AM

this is my error

Screen Shot 2019-11-12 at 10 55 46 AM

what could be happening???

nurkeevich commented 4 years ago

@redreceipt replace your variable contentId to id in your request block.

chaiiplss commented 4 years ago

@redreceipt In the query, you have defined one more __typename (line-11) but you are not returning it in mocks.