[Doc] Fix examples of ra-test with fake dataProviders #6600
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
You helped me in #6597, so I figured I could make the docs better for future me and everyone.
I haven't tested the code to see if it works. Also, a few notes:
await act(async () => await new Promise(r => setTimeout(r)));
dance. It seems that simplyawait
ing was enough to follow properly the event loop.jest.fn().resolve
since the examples weren't using the mocked function for some assertionsqueryBy
withfindBy
which is the asynchronous equivalent. In my own code, it's required or the rendered content is the inital one before the dataProvider was called.Feel free to adjust the code before merging, there's no guarantee it's correct in the context of the examples.