Skip to content

Commit

Permalink
Remove react-router-dom
Browse files Browse the repository at this point in the history
  • Loading branch information
K-Markopoulos committed Jan 23, 2025
1 parent c63b27b commit fb2bdf1
Show file tree
Hide file tree
Showing 32 changed files with 7,484 additions and 552 deletions.
4 changes: 0 additions & 4 deletions packages/website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,6 @@
"react-leaflet-markercluster": "^4.2.1",
"react-material-ui-carousel": "3.4.2",
"react-redux": "^7.2.0",
"react-router-dom": "^6.0.0",
"react-router-hash-link": "^2.4.3",
"react-slick": "^0.30.3",
"react-swipeable-bottom-sheet": "^1.1.2",
"react-swipeable-views": "^0.14.0",
Expand Down Expand Up @@ -104,8 +102,6 @@
"@types/react-dom": "18.3.1",
"@types/react-leaflet": "^2.5.1",
"@types/react-redux": "^7.1.7",
"@types/react-router-dom": "^5.1.3",
"@types/react-router-hash-link": "^2.4.9",
"@types/react-slick": "^0.23.4",
"@types/react-swipeable-views": "^0.13.0",
"@types/redux-mock-store": "^1.0.2",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { mockSite } from 'mocks/mockSite';
import { mockDataRange } from 'mocks/mockDataRange';
import { mockTimeSeries } from 'mocks/mockTimeSeries';
import { mockGranularDailyData } from 'mocks/mockGranularDailyData';
import { MemoryRouter } from 'react-router-dom';
import { SnackbarProvider } from 'notistack';
import { mockSurveyList } from 'mocks/mockSurveyList';
import { mockSurvey } from 'mocks/mockSurvey';
Expand Down Expand Up @@ -60,25 +59,19 @@ describe('MultipleSensorsCharts', () => {
(jest as any).setSystemTime(new Date('2023-06-28T21:00:00.000Z'));

element = render(
<MemoryRouter
initialEntries={[
{ pathname: '/sites/1', search: '?start=2022-05-28&end=2022-06-28' },
]}
>
<ThemeProvider theme={theme}>
<SnackbarProvider>
<Provider store={store}>
<MultipleSensorsCharts
site={mockSite}
disableGutters
displayOceanSenseCharts
surveysFiltered={false}
hasAdditionalSensorData={false}
/>
</Provider>
</SnackbarProvider>
</ThemeProvider>
</MemoryRouter>,
<ThemeProvider theme={theme}>
<SnackbarProvider>
<Provider store={store}>
<MultipleSensorsCharts
site={mockSite}
disableGutters
displayOceanSenseCharts
surveysFiltered={false}
hasAdditionalSensorData={false}
/>
</Provider>
</SnackbarProvider>
</ThemeProvider>,
).container;

jest.useRealTimers();
Expand Down
13 changes: 5 additions & 8 deletions packages/website/src/common/RegisterDialog/index.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { render } from '@testing-library/react';
import { Provider } from 'react-redux';
import configureStore from 'redux-mock-store';
import { BrowserRouter as Router } from 'react-router-dom';
import { mockUser } from 'mocks/mockUser';

import RegisterDialog from '.';
Expand All @@ -23,13 +22,11 @@ describe('RegisterDialog', () => {

element = render(
<Provider store={store}>
<Router>
<RegisterDialog
open
handleRegisterOpen={jest.fn}
handleSignInOpen={jest.fn}
/>
</Router>
<RegisterDialog
open
handleRegisterOpen={jest.fn}
handleSignInOpen={jest.fn}
/>
</Provider>,
).container;
});
Expand Down
7 changes: 1 addition & 6 deletions packages/website/src/common/RouteButtons/index.test.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
import { render } from '@testing-library/react';

import { BrowserRouter } from 'react-router-dom';
import RouteButtons from '.';

test('renders as expected', () => {
const { container } = render(
<BrowserRouter>
<RouteButtons />
</BrowserRouter>,
);
const { container } = render(<RouteButtons />);
expect(container).toMatchSnapshot();
});
5 changes: 1 addition & 4 deletions packages/website/src/common/Search/index.test.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { Provider } from 'react-redux';
import { BrowserRouter as Router } from 'react-router-dom';
import { render } from '@testing-library/react';
import configureStore from 'redux-mock-store';

Expand All @@ -23,9 +22,7 @@ describe('Search', () => {

element = render(
<Provider store={store}>
<Router>
<Search />
</Router>
<Search />
</Provider>,
).container;
});
Expand Down
13 changes: 5 additions & 8 deletions packages/website/src/common/SignInDialog/index.test.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { render } from '@testing-library/react';
import { Provider } from 'react-redux';
import configureStore from 'redux-mock-store';
import { BrowserRouter as Router } from 'react-router-dom';
import { mockUser } from 'mocks/mockUser';

import SignInDialog from '.';
Expand All @@ -23,13 +22,11 @@ describe('SignInDialog', () => {

element = render(
<Provider store={store}>
<Router>
<SignInDialog
open
handleRegisterOpen={jest.fn}
handleSignInOpen={jest.fn}
/>
</Router>
<SignInDialog
open
handleRegisterOpen={jest.fn}
handleSignInOpen={jest.fn}
/>
</Provider>,
).container;
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { render } from '@testing-library/react';
import { Provider } from 'react-redux';
import configureStore from 'redux-mock-store';
import { BrowserRouter as Router } from 'react-router-dom';

import { parseLatestData } from 'store/Sites/helpers';
import { mockUser } from 'mocks/mockUser';
Expand All @@ -27,9 +26,7 @@ describe('Sensor Card', () => {

element = render(
<Provider store={store}>
<Router>
<Sensor depth={mockSite.depth} id={mockSite.id} data={data} />
</Router>
<Sensor depth={mockSite.depth} id={mockSite.id} data={data} />
</Provider>,
).container;
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
import { render } from '@testing-library/react';
import { BrowserRouter as Router } from 'react-router-dom';
import AddButton from '.';

test('renders as expected', () => {
const { container } = render(
<Router>
<AddButton siteId={1} />
</Router>,
);
const { container } = render(<AddButton siteId={1} />);
expect(container).toMatchSnapshot();
});
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { render } from '@testing-library/react';
import { mockReefCheckSurvey } from 'mocks/mockReefCheckSurvey';
import { ReefCheckSurvey } from 'store/ReefCheckSurveys';
import { BrowserRouter } from 'react-router-dom';
import { ThemeProvider } from '@mui/material';
import theme from 'layout/App/theme';
import { ReefCheckSurveyCard } from '.';
Expand All @@ -10,11 +9,9 @@ describe('ReefCheckSurveyCard', () => {
function renderReefCheckSurveyCard(overrides: Partial<ReefCheckSurvey> = {}) {
return render(
<ThemeProvider theme={theme}>
<BrowserRouter>
<ReefCheckSurveyCard
survey={{ ...mockReefCheckSurvey, ...overrides }}
/>
</BrowserRouter>
<ReefCheckSurveyCard
survey={{ ...mockReefCheckSurvey, ...overrides }}
/>
</ThemeProvider>,
);
}
Expand Down
29 changes: 0 additions & 29 deletions packages/website/src/layout/App/index.test.tsx

This file was deleted.

148 changes: 0 additions & 148 deletions packages/website/src/layout/App/index.tsx

This file was deleted.

Loading

0 comments on commit fb2bdf1

Please sign in to comment.