DEV Community

Discussion on: Testing Vue+Apollo: 2020 edition

Collapse
 
myfailemtions profile image
Martirossyan Ararat

Amazing topic, thank you. But how are you fixing warnings about local queries and mutations?

Found @client directives in a query but no ApolloClient resolvers were specified. This means ApolloClient local resolver handling has been disabled, and @client directives will be passed through to your link chain.

I have this error when I'm using @client directive on my local queries

Collapse
 
madhj profile image
Madhusudan H J

You need to add local resolvers when we createMockClient.
createMockClient({
resolvers: {
Mutation: {
Your_Mutation_Resolvers_Here
},
Query: {
Your_Query_Resolvers_Here
},
}
})

And do not set Request handlers, instead use writeQuery() to initialize the cache.
mockclient.cache.writeQuery({ ... })