Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions src/__tests__/App.test.jsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,22 @@
import { describe, it, expect } from 'vitest';
import { render, screen } from '@testing-library/react';
import { describe, it, expect, vi } from 'vitest';
import { render } from '@testing-library/react';
import App from '../App';

// Mock heavy map/chart dependencies
vi.mock('react-leaflet', () => ({
MapContainer: ({ children }) => <div data-testid="map-container">{children}</div>,
MapContainer: ({ children }) => (
<div data-testid="map-container">{children}</div>
),
TileLayer: () => <div />,
Marker: () => <div />,
Popup: ({ children }) => <div>{children}</div>,
useMap: () => ({ setView: vi.fn() }),
}));

vi.mock('recharts', () => ({
LineChart: ({ children }) => <div data-testid="line-chart">{children}</div>,
LineChart: ({ children }) => (
<div data-testid="line-chart">{children}</div>
),
Line: () => <div />,
XAxis: () => <div />,
YAxis: () => <div />,
Expand All @@ -29,7 +33,6 @@ vi.mock('recharts', () => ({

describe('App', () => {
it('renders without crashing', () => {
// App already contains its own BrowserRouter — render directly
render(<App />);
expect(document.body).toBeTruthy();
});
Expand Down