mardi 28 mars 2017

I am not able to set a specefic path in test

Problem: My App component is responsible to render the other components based on the path. So inorder to test it, I need to be able to "set" the path. e.g I'd like to see the SignUp component is rendered when the path is /sign-up.

What I've done: I thought I could use initialEntries to give the MemoryRouter an initial path (unsuccessful) then I thought I might be able to use Route/Redirect directly in my test inside MemoryRouter to set the path, but that did not work either.

Specification:

  • React 15
  • React Router 4 (react-router-dom)
  • Redux 3.6
  • Jest (the one comes with create-react-app)
  • Yo can find the code on the branch with the issue

Aucun commentaire:

Enregistrer un commentaire