#graphql Snapshot #testing with Jest and OnlineOrNot
▻https://hackernoon.com/graphql-snapshot-testing-with-jest-and-onlineornot-76a692390a90?source=r
You, right now — probably.We can all agree testing is quite important if you want to maintain developer happiness. It makes refactoring code a joy, and it generally helps build confidence in your codebase.In general, unit tests are possible in GraphQL by testing your resolvers, and ensuring the logic is sound. But what if we want to test a whole query, and detect when fields are deleted, renamed, added or fields return different data?I’ll show you a quick code example of how you can do this locally.Using Jest for GraphQL Snapshot TestingYou can clone a demo repo for this blog post here: ▻https://github.com/rozenmd/graphql-snapshot-testingimport graphqlHTTP from ’express-graphql’import getCountries from ’./resolvers’import schema from ’./schema’test(’the snapshot (...)