I have a component that can be hit through two flows. One route is user/Plan
and the other is user/:userId/Plan
. I have different parts of the component that render based on a value I get from calling useParams
to see which flow we are going through. Is there a way I can render the component and ensure it uses the user/:userId/Plan
flow?
I’m able to get the default tested just by doing the following:
const result = render(
<BrowserRouter>
<UserPlan model={modelStub} />
</BrowserRouter>,
);
However, I’m not sure how I can force it to render with the url user/:userId/Plan
? Am I going about this the wrong way? Should I just be mocking useParams or something?