Fixed testing

This commit is contained in:
Gregory Campbell
2026-06-14 12:34:45 -04:00
parent de4ace08ff
commit 9661ae1a68
4 changed files with 8 additions and 11 deletions
+1 -1
View File
@@ -18,7 +18,7 @@
"react-dom": "^18.2.0",
"react-helmet-async": "^1.3.0",
"react-router-dom": "^6.8.0",
"react-scripts": "5.0.1",
"react-scripts": "^5.0.1",
"web-vitals": "^2.1.4",
"yaml": "2.9.0"
},
+3 -3
View File
@@ -30,9 +30,9 @@
"react-dom": "^18.2.0",
"react-helmet-async": "^1.3.0",
"react-router-dom": "^6.8.0",
"react-scripts": "5.0.1",
"yaml": "2.9.0",
"web-vitals": "^2.1.4"
"react-scripts": "^5.0.1",
"web-vitals": "^2.1.4",
"yaml": "2.9.0"
},
"devDependencies": {
"@testing-library/jest-dom": "^5.16.4",
+4 -4
View File
@@ -3,10 +3,10 @@ import { render, screen } from '@testing-library/react';
import App from './App';
// Mock the child components to isolate the App component's routing logic
jest.mock('./pages/Home', () => ({ Home: () => <div>Mock Home</div> }));
jest.mock('./pages/Resume', () => ({ Resume: () => <div>Mock Resume</div> }));
jest.mock('./pages/Projects', () => ({ Projects: () => <div>Mock Projects</div> }));
jest.mock('./pages/Contact', () => ({ Contact: () => <div>Mock Contact</div> }));
jest.mock('./pages/Home', () => ({ __esModule: true, default: () => <div>Mock Home</div> }));
jest.mock('./pages/Resume', () => ({ __esModule: true, default: () => <div>Mock Resume</div> }));
jest.mock('./pages/Projects', () => ({ __esModule: true, default: () => <div>Mock Projects</div>,}));
jest.mock('./pages/Contact', () => ({ __esModule: true, default: () => <div>Mock Contact</div> }));
jest.mock('./404', () => ({ NoMatch: () => <div>Mock NoMatch</div> }));
// Mock the layout components
-3
View File
@@ -1,6 +1,5 @@
import React from 'react';
import { createRoot } from 'react-dom/client';
import { HelmetProvider } from 'react-helmet-async';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
@@ -10,9 +9,7 @@ const root = createRoot(container);
root.render(
<React.StrictMode>
<HelmetProvider>
<App />
</HelmetProvider>
</React.StrictMode>
);