I am doing unit tests on a react app that is using relay as a graphql client when testing , i get mocked data with like this :
title: '<mock-value-for-field-"title">',
How can i define default mock data ?
I am doing unit tests on a react app that is using relay as a graphql client when testing , i get mocked data with like this :
title: '<mock-value-for-field-"title">',
How can i define default mock data ?
To mock the specific value of a field in Relay you will want to use
MockPayloadGenerator
.https://relay.dev/docs/guides/testing-relay-components/#mock-payload-generator-and-the-relay_test_operation-directive
Will need more code to give a complete example but essentially will need to do something similar to: