score:0

you are trying to render your component in isolation, which means you don't have access to the useparams object. i'm not sure how to do this with enzyme, but here is how it works with testing library, which i believe should work with enzyme also.

try to wrap your component in your test suit with a router and pass the history object as a prop:

import {creatememoryhistory} from 'history'
const browsewithrouter = () => {
    const history = creatememoryhistory();
    return (
        <router history={history}>
            <browse />
        </router>
    )
};

then shallow render your new component:

const component = shallow(<browsewithrouter />)

Related Query

More Query from same tag