How to fix Apollo’s MockedProvider returning empty objects for fragments

Charles Stover
3 min readAug 20, 2021

If you’re like me, you burned your wheels a little too long trying to figure out why your mocked data was empty in your React unit tests.

In my case, I had a query like this:

query GetSomething($somethingId: UUID!) {
something(somethingId: $somethingId) {
...something
things {
...thing
}
}
}…

--

--