ERROR: Not implemented navigation ( except hash changes ) #60125
Unanswered
annaLucian
asked this question in
App Router
Replies: 1 comment
-
This approach solved my issue when using NextJS Link. jest.mock("next/link", () => {
const mockLink = ({
children,
href,
onClick,
}: {
children: React.ReactNode;
href: string;
onClick: () => void;
}) => {
return (
<a
href={href}
onClick={(e) => {
e.preventDefault();
onClick();
}}
>
{children}
</a>
);
};
mockLink.displayName = "Link";
return mockLink;
}); |
Beta Was this translation helpful? Give feedback.
0 replies
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.
-
Hi I am facing a problem when I trying to do a test
Tools:
Problem:
ERROR:
Error: Not implemented: navigation (except hash changes)
at module.exports (/Users/manuel.ochoa/Desktop/PERSONAL/doctor-who/node_modules/jsdom/lib/jsdom/browser/not-implemented.js:9:17)
at navigateFetch (/Users/manuel.ochoa/Desktop/PERSONAL/doctor-who/node_modules/jsdom/lib/jsdom/living/window/navigation.js:77:3)
at exports.navigate (/Users/manuel.ochoa/Desktop/PERSONAL/doctor-who/node_modules/jsdom/lib/jsdom/living/window/navigation.js:55:3)
at Timeout._onTimeout (/Users/manuel.ochoa/Desktop/PERSONAL/doctor-who/node_modules/jsdom/lib/jsdom/living/nodes/HTMLHyperlinkElementUtils-impl.js:81:7)
at listOnTimeout (node:internal/timers:569:17)
at processTimers (node:internal/timers:512:7) {
type: 'not implemented'
}
Thanks in advance
Beta Was this translation helpful? Give feedback.
All reactions