react-apollo-hooks icon indicating copy to clipboard operation
react-apollo-hooks copied to clipboard

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

Open viniciusavieira opened this issue 5 years ago • 5 comments

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

viniciusavieira avatar May 29 '19 16:05 viniciusavieira

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..

jzabala avatar Jun 14 '19 03:06 jzabala

Thanks so much @jzabala , this save my day

Jaman-dedy avatar Oct 16 '19 07:10 Jaman-dedy

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???

redreceipt avatar Nov 12 '19 15:11 redreceipt

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

nurkeevich avatar Jan 09 '20 16:01 nurkeevich

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

chaiiplss avatar Sep 09 '20 11:09 chaiiplss