Files
unicorn-utterances/__mocks__/modules/next-link.tsx
Corbin Crutchley 6e52c81f4b chore: fix tests
2021-12-26 17:33:21 -08:00

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 {};