Skip to content
This repository has been archived by the owner on Nov 15, 2022. It is now read-only.

Feature: Static route for testing purposes #15

Closed
danielkcz opened this issue Mar 27, 2019 · 2 comments
Closed

Feature: Static route for testing purposes #15

danielkcz opened this issue Mar 27, 2019 · 2 comments

Comments

@danielkcz
Copy link

In a couple of automated tests, we need to set the current route so it renders what's expected based on the current route.

I suppose it's as easy as exposing a function that modifies closest context value. It could be tricky in regards to nested routing though because tests don't include the whole App, but only a portion of it.

@Paratron
Copy link
Owner

In a node context you can use the to-be-documented method setPath(). Testing frontend features would require to mock history and location. Maybe its better to fire up a static server and go over the test app with cypress.

@danielkcz
Copy link
Author

danielkcz commented Mar 27, 2019

Maybe its better to fire up a static server and go over the test app with cypress.

Sure, that works in most cases. But sometimes there is a route driven logic in the component when I don't want to be prop drilling some route parameters. Wondering if that would be still possible with this lib though 🤔

Testing frontend features would require to mock history and location

I believe that's already part of the jest-environment-jsdom, so that should be fine.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants