Replies: 1 comment 1 reply
-
I think the first one is a problem many people reported, the testing helper doesn’t support components using the component props You could create a route component that calls useLoaderData and useActionData and pass that to your own component as a prop The second issue, the createRoutesStub is to test React components in the context of React Router To test loaders and actions you could just call them as normal functions, you will need to pass a Request instance, a params object and a context object Although instead of testing the loaders and actions I recommend you to test the logic inside. If you move that to another functions you don’t need to simulate a request to test them. |
Beta Was this translation helpful? Give feedback.
-
Hi,
I work on a new SPA project and I want to use React Router v7 (framework).
The problem is I don't see how to test my app like I used to (vitest, testing library, msw, ...).
I read this page : Testing but there are 2 problems :
Any Idea ?
Regards,
Beta Was this translation helpful? Give feedback.
All reactions