The tricky part when unit testing Gatsby code is how to handle components that use GraphQL queries. You might want to take a look at my plugin gatsby-plugin-testing
that makes that possible. It stores the query data when you run gatsby build
so it can feed the actual data back to the components when running the tests.