MSW Testing with GraphQL API and how to? #898
Replies: 2 comments 7 replies
-
Hey, @SamDev9228. Please follow the Mocking GraphQL API part of our tutorial to learn more about how to do it with MSW. In nutshell, mocking GraphQL API is very similar to mocking REST API:
You may also find this React GraphQL (Apollo) usage example useful. I trust you to see through React-specific code in the test, as it has nothing to do with the testing setup. You can apply the same testing setup for your Vue application. |
Beta Was this translation helpful? Give feedback.
-
Heya, Thank you I did the suggested however I am getting the following error:
on
and in my handlers I have a Gql query that returns data etc? |
Beta Was this translation helpful? Give feedback.
-
I was wondering how to test my GraphQL API in my vue application. I'm currently using the JEST framework and was wondering what should I expect and how to make the mocked graphQL requests? Do I just mount my component and pass in an Apollo mock etc.?
There is not many examples of setting up a test in a vue application using the GraphQL side of things so was wondering if anyone can point me in the right direction here?
Very much appreciated :)
Beta Was this translation helpful? Give feedback.
All reactions