Why is `newData` attribute in `MockedResponse` not available in documentation?

I’ve been working with Apollo Client on a project for quite some months, and we’ve been using Jest for testing and Storybook for the component catalog.

So far, we did not have any issues testing with Jest using MockedProvider: it is easy to mock the queries, and most of the time you need to mock one or two, so no problem.

On the other side, when developing for Storybook, because MockedProvider only mocks the number of queries you pass to mocks, the components where not very interactive. We could add 10 times a query to the mocks, but that was far from ideal.

After some investigation (Google + Stackoverflow…), I found out that there’s an attribute called newData inside the MockedResponse, that generates responses dynamically for mocked components.

I find it quite useful if you use it wisely. Of course, the idea of having non-dynamic responses is a clever idea for unit testing, but for other purposes like Storybook, the dynamic responses are particularly useful.

So, why is this parameter nonpublished in the documentation? I find it very convenient, and unless I’ve missinterpret the idea of what this paremeter is about, the only explanation I can find is to prevent junior developers to overuse newData instead of response. I can understand that, but I’d rather have all the options and let the developers decide.

1 Like

Thanks @lacasa - omitting this from the docs isn’t intentional. cc @StephenBarlow