mirror of
https://github.com/LukeHagar/unicorn-utterances.git
synced 2025-12-06 04:21:55 +00:00
28 lines
526 B
TypeScript
28 lines
526 B
TypeScript
export const mockOnLinkClick = jest.fn();
|
|
|
|
afterEach(() => {
|
|
mockOnLinkClick.mockReset();
|
|
});
|
|
|
|
jest.mock("next/link", () => {
|
|
const React = require("react");
|
|
const { default: Link } = jest.requireActual("next/link");
|
|
|
|
return function NextLink(props: any) {
|
|
return (
|
|
<Link
|
|
{...props}
|
|
onClick={(e: Event) => {
|
|
e.preventDefault();
|
|
e.stopPropagation();
|
|
mockOnLinkClick();
|
|
}}
|
|
>
|
|
{props.children}
|
|
</Link>
|
|
);
|
|
};
|
|
});
|
|
|
|
export default {};
|