You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I tried to mock the navigate function since jsom doesn't handle html5 navigations but it seems that the navigate function exported in the root component is not the same as the one exported from history.
Is there a common function between those two that I can mock ?
See #76 for the main navigate mock
See #371 for the history navigate mock
EDIT: there is also the redirect which is missing
But while these 2 seems to work, you need to mock them differently and know in advance which one will be called (so you can't change a link into a button for example).
What I tried
As I said earlier I tried to mock the main navigate function but it's not triggered with a Link.
I tried to mock the Link but the BaseContext is not exported, nor is the shouldNavigate.
I tried to change the History to a HashHistory but the result isn't what I wanted since it doesn't test HTML5 navigations and I need to create my own history and mock it.
Solutions
Provide all necessary variables in export
Create a common function for navigate
Maybe provide a hash history (I know that hash history is for react-router@v6 but if I develop one, should I make a PR ?)
The text was updated successfully, but these errors were encountered:
I tried to mock the navigate function since jsom doesn't handle html5 navigations but it seems that the navigate function exported in the root component is not the same as the one exported from history.
Is there a common function between those two that I can mock ?
See #76 for the main navigate mock
See #371 for the history navigate mock
EDIT: there is also the redirect which is missing
But while these 2 seems to work, you need to mock them differently and know in advance which one will be called (so you can't change a link into a button for example).
What I tried
As I said earlier I tried to mock the main navigate function but it's not triggered with a Link.
I tried to mock the Link but the
BaseContext
is not exported, nor is theshouldNavigate
.I tried to change the History to a HashHistory but the result isn't what I wanted since it doesn't test HTML5 navigations and I need to create my own history and mock it.
Solutions
navigate
The text was updated successfully, but these errors were encountered: