refactoring node 24

This commit is contained in:
2025-11-10 10:10:57 +01:00
parent c4a3ac0811
commit a76545383f
6 changed files with 51 additions and 20 deletions

View File

@@ -3,3 +3,28 @@
// 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 });