// jest-dom adds custom jest matchers for asserting on DOM nodes.
// allows you to do things like:
// expect(element).toHaveTextContent(/react/i)
// learn more: https://github.com/testing-library/jest-dom
import '@testing-library/jest-dom';
import React from 'react';

jest.mock('react-router-dom', () => {
  const navigate = jest.fn();

  const PassThrough = ({ children }) => <>{children}</>;

  const Route = ({ element = null, children = null }) => element || children || null;

  const Link = ({ children, ...props }) => (
    <a {...props} data-mock-link="true">
      {children}
    </a>
  );

  return {
    BrowserRouter: PassThrough,
    Routes: PassThrough,
    Route,
    Navigate: () => null,
    Link,
    useLocation: () => ({ pathname: '/' }),
    useNavigate: () => navigate
  };
}, { virtual: true });
