cypress-io/cypress-react-unit-test

Cannot mount the component wrapped in withRouter

khateeb321 opened this issue · 2 comments

I have a scenario where my component is wrapped in withRouter

..
..
..
export default withRouter(myReactComponent)

I need to access the state in my test, normal component goes like this

it('get that state', function() {
        mountHook(() =>  myReactComponent({
            props: values
        })).then((result: any) => {
            console.log(result.current.state)
            ...
        })
    })

It will never work if the component is within withRouter, I couldn't find any example either.
Am I missing something?

Can you give me fully reproducible example, please? Similar to #388 for example, you can fork this repo https://github.com/bahmutov/test-react-router-v5 for example and add it there.

closing without reproduction