testing in react-create-app stack
See original GitHub issueHi. I’m using CRA, with mobx, react-router@4 and this project.
In the app itself everything goes well. I have routerStore like example, and I pass history prop to Router.
I need withRouter
for every component that uses this functionality but that’s fine.
The problem starts at testing,
I manage to change path from the app (with simulate click on some btn that do props.history.push('..')
)
with
function assertCorrectPath(ev) { expect(ev).toEqual('/'); } MainWrapper.context().router.history.listen(assertCorrectPath);
I have it on context thanks to:
react-router-test-context.
But, I cannot be in sync with path when I change it from the test:
I do wrapper.context().router.history.push('cc');
and the Component is not rendered accordingly.
Is there any easier way for all that?
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (6 by maintainers)
file at
stores/Router
is:ok , ill try. thx