Use real data provider for testing
See original GitHub issueIs your feature request related to a problem? Please describe.
I would like to enable my data provider for testing, so I can test my custom components and their side effects better (i.e. requests that are triggered). I’m using jest and react-testing-library and by default when I wrap the components I’d like to test using the <TestContext enableReducers> component, all data provider requests always respond with { data: null }.
Describe the solution you’d like
I think it would be ideal to be able to pass the real data provider to the TestContext component so it will be used by the test application.
Describe alternatives you’ve considered
I tried to rewrite the TestContext component and used my data provider. It never triggered any requests though and failed inside the react admin data reducer (for a create request inside the addOneRecord function, with newRecord set to null)
I’m not sure why my data provider wasn’t triggering any requests and ended up inside the react admin data reducer before doing so. With some guidance why this happened, I would be happy to implement this feature if it is doable.
Issue Analytics
- State:
- Created 3 years ago
- Reactions:5
- Comments:19 (15 by maintainers)

Top Related StackOverflow Question
While adding the
customReducersoption I noticed the ReadME ofra-testpackage lacks some notes for therenderWithReduxfunction. Would you like me to add a section about it with some examples?Yes, it would be really appreciated. Thanks!