mardi 4 août 2020

How to integration test for React component wrapped in layouts?

i have a component that wrapped in layout. Here is it

function UserProfile({ user }) {
 return (
   <ApplicationLayout>
     <div class="content">
       <h1>{user.name}</h1>
     </div>
   </ApplicationLayout>
 )
}

The ApplicationLayout is a Redux connected component who wrap a children, and its children could also be a Redux connected component.

when I try to mount the component with enzyme, I got an error that a props in the layout is not defined. how can I give fake props to the ApplicationLayout when testing the UserProfile component?

Aucun commentaire:

Enregistrer un commentaire