jolly-oil-35623
07/21/2022, 5:07 PMroute()
in the application code is resolved by the build process.
Fast-forward to component testing - my application code / component references this route()
function. I'm trying to stub it out:
import { route } from 'ziggy-js';
...
beforeEach(() => {
const submitUrl = 'support.store';
const cancelUrl = 'users.index';
cy.stub(route).as('route');
cy.mount(
<SupportForm
submitUrl={submitUrl}
cancelUrl={cancelUrl}
/>
);
}
But whenever the code is called in the test, I get:
> - click
> (uncaught exception)ReferenceError: route is not defined