DEV Community

Discussion on: Testing Vue+Apollo: 2020 edition

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({ ... })