Ask questionsUsing MockedProvider results in error "No more mocked responses for the query: ..."
I'm not sure why this happens, it seems I need to set up some MockedResponses but I don't know how to do that. When I console.log _this.mockedResponsesByKey and key in MockNetworkInterface.prototype.query it looks like the keys don't match because one is a string and the other is an object. I could be reading this wrong though.
Mount a MockedProvider using enzyme.
const query = addTypenameToDocument(myQuery);
const mounted = mount(
<MockedProvider mocks={[
{
request: { query, variables },
result: { data: mockedData },
}
]}>
<ConnectedComponent { ... routerParams } store={store} />
</MockedProvider>
);
The component receives No more mocked responses for the query: ... in this.props.data.error
Should not throw an error
Answer
questions
FernandoBasso
If you refetch the query twice you will need three identical mock requests and responses.
This part of the answer was especially important for me (in my case it is a fetchMore). I don't think it is mentioned the docs.
Related questions