Dummy data on third party graphql query? #27614
-
Using This has raised two issues,
Is there a way I can provide dummy data for testing? |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
I've had great success with mocking the There's some great info on this page: https://www.gatsbyjs.com/docs/unit-testing/#mocking-gatsby |
Beta Was this translation helpful? Give feedback.
I've had great success with mocking the
useStaticQuery
to return dummy data. If you use page Queries you can pass in a data prop with the dummy data as well. This works well for a simple schema, if you have a lot of custom resolvers the complexity can become somewhat problematic but none-the-less usable.There's some great info on this page: https://www.gatsbyjs.com/docs/unit-testing/#mocking-gatsby