Stubbing route change (Gatsby) #19471
Unanswered
joshuacassidygrant
asked this question in
Component Testing
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
My component under test has a button that navigates the user to another route. Obviously I do not want this to execute, so I'd like to stub it. I am not sure how to do this, and when I don't I get:
Uncaught TypeError: window.___navigate is not a function
I am using Gatsby and the button is (eventually) calling the Gatsby "navigate" function. I have tried using cy.stub on the module in question, and even on window.navigate but this doesn't seem to work. Does anyone have an easy way to do this?
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions