For anyone coming here wondering why they're getting errors like No more mocked responses for the query...
If you're using the @connection directive for helping with paginated caching, this standalone version of the mock link is not sufficient without some help. The issue has been fixed in react-apollo, where this link was extracted from: https://github.com/apollographql/react-apollo/pull/2523/files
I'm not sure if the right action would be to update this link here or to deprecate this repo to avoid future confusion. It seems strange to have these two maintained in parallel, but at any rate, hopefully this issue will save someone some time while googling/looking around. A workaround if people still wish to continue using this project is to utilize removeConnectionDirectiveFromDocument from apollo-utilities.
import { removeConnectionDirectiveFromDocument } from 'apollo-utilies';
const mock = {
request: {
query: removeConnectionDirectiveFromDocument(myQueryDocumentThatIncludesAConnectionDirective),
variables: { ... }
},
result: { ... }
};
const client = new ApolloClient({
cache: ...,
link: new MockLink([mock])
});
Feel free to close this issue @trojanowski if you're not interested in updating this project with those fixes - I just wanted to get this out there in case it's helpful for anyone. I started using react-apollo/test-utils directly for my use-case because I'm already relying on that project, but I understand people might have valid reasons for using this fork.
For anyone coming here wondering why they're getting errors like
No more mocked responses for the query...If you're using the
@connectiondirective for helping with paginated caching, this standalone version of the mock link is not sufficient without some help. The issue has been fixed inreact-apollo, where this link was extracted from: https://github.com/apollographql/react-apollo/pull/2523/filesI'm not sure if the right action would be to update this link here or to deprecate this repo to avoid future confusion. It seems strange to have these two maintained in parallel, but at any rate, hopefully this issue will save someone some time while googling/looking around. A workaround if people still wish to continue using this project is to utilize
removeConnectionDirectiveFromDocumentfromapollo-utilities.Feel free to close this issue @trojanowski if you're not interested in updating this project with those fixes - I just wanted to get this out there in case it's helpful for anyone. I started using
react-apollo/test-utilsdirectly for my use-case because I'm already relying on that project, but I understand people might have valid reasons for using this fork.