Skip to content

Commit

Permalink
Update react router major and minor other dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
augusticor committed Jan 16, 2025
1 parent 5c2c71a commit 212ba5c
Show file tree
Hide file tree
Showing 7 changed files with 1,328 additions and 2,988 deletions.
10 changes: 10 additions & 0 deletions jest.setup.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
import { TextEncoder, TextDecoder } from 'node:util'

if (!global.TextEncoder) {
global.TextEncoder = TextEncoder
}

if (!global.TextDecoder) {
global.TextDecoder = TextDecoder
}

require('dotenv').config({
path: '.env.test',
});
Expand Down
4,235 changes: 1,281 additions & 2,954 deletions package-lock.json

Large diffs are not rendered by default.

36 changes: 18 additions & 18 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,30 +10,30 @@
"ghcitests": "jest -u"
},
"dependencies": {
"@reduxjs/toolkit": "2.2.8",
"axios": "1.7.7",
"@reduxjs/toolkit": "2.5.0",
"axios": "1.7.9",
"date-fns": "4.1.0",
"react": "18.3.1",
"react-big-calendar": "1.15.0",
"react-datepicker": "7.4.0",
"react-big-calendar": "1.17.1",
"react-datepicker": "7.6.0",
"react-dom": "18.3.1",
"react-modal": "3.16.1",
"react-redux": "9.1.2",
"react-router-dom": "6.26.2",
"sweetalert2": "11.14.2"
"react-modal": "3.16.3",
"react-redux": "9.2.0",
"react-router": "7.1.1",
"sweetalert2": "11.15.10"
},
"devDependencies": {
"@babel/preset-env": "7.25.8",
"@babel/preset-react": "7.25.7",
"@testing-library/react": "16.0.1",
"@types/jest": "29.5.13",
"@types/react": "18.3.11",
"@types/react-dom": "18.3.0",
"@vitejs/plugin-react": "4.3.2",
"@babel/preset-env": "7.26.0",
"@babel/preset-react": "7.26.3",
"@testing-library/react": "16.1.0",
"@types/jest": "29.5.14",
"@types/react": "19.0.7",
"@types/react-dom": "19.0.3",
"@vitejs/plugin-react": "4.3.4",
"babel-jest": "29.7.0",
"dotenv": "16.4.5",
"dotenv": "16.4.7",
"jest": "29.7.0",
"jest-environment-jsdom": "29.7.0",
"vite": "5.4.8"
"vite": "6.0.7"
}
}
}
2 changes: 1 addition & 1 deletion src/CalendarApp.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Provider } from 'react-redux';
import { BrowserRouter } from 'react-router-dom';
import { BrowserRouter } from 'react-router';
import { AppRouter } from './router/AppRouter';
import { store } from './store';

Expand Down
29 changes: 16 additions & 13 deletions src/router/AppRouter.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { useEffect } from 'react';
import { Navigate, Route, Routes } from 'react-router-dom';
import { useAuthStore } from '../hooks';
import { LoginPage } from '../auth';
import { Loader } from '../auth/pages/Loader';
import { CalendarPage } from '../calendar';
import { useEffect } from "react";
import { Navigate, Route, Routes } from "react-router";
import { useAuthStore } from "../hooks";
import { LoginPage } from "../auth";
import { Loader } from "../auth/pages/Loader";
import { CalendarPage } from "../calendar";

export const AppRouter = () => {
const { status: authStatus, checkAuthToken } = useAuthStore();
Expand All @@ -14,25 +14,28 @@ export const AppRouter = () => {
checkAuthToken();
}, []);

if (authStatus === 'checking') {
if (authStatus === "checking") {
return <Loader />;
}

return (
<Routes>
{authStatus === 'not-authenticated' ? (
{authStatus === "not-authenticated" ? (
<>
<Route path='/auth/*' element={<LoginPage />} />
<Route path='/*' element={<Navigate to='/auth/login' />} />
<Route path="/auth">
<Route path="*" element={<LoginPage />} />
</Route>

<Route path="*" element={<Navigate to="/auth/login" />} />
</>
) : (
<>
<Route path='/' element={<CalendarPage />} />
<Route path='/*' element={<Navigate to='/' />} />
<Route path="/" element={<CalendarPage />} />
<Route path="*" element={<Navigate to="/" />} />
</>
)}

<Route path='/*' element={<Navigate to='/auth/login' />} />
<Route path="*" element={<Navigate to="/auth/login" />} />
</Routes>
);
};
2 changes: 1 addition & 1 deletion tests/hooks/useAuthStore.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ const getMockStore = (initialState = {}) => {
describe('Tests on useAuthStore custom hook', () => {
beforeEach(() => localStorage.clear());

test('should return default props and functions', () => {
test('should return default status and functions', () => {
const mockedStore = getMockStore(defaultState);

const { result } = renderHook(() => useAuthStore(), {
Expand Down
2 changes: 1 addition & 1 deletion tests/router/AppRouter.test.jsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { render, screen } from '@testing-library/react';
import { MemoryRouter } from 'react-router-dom';
import { MemoryRouter } from 'react-router';
import { useAuthStore } from '../../src/hooks/useAuthStore';
import { AppRouter } from '../../src/router/AppRouter';

Expand Down

0 comments on commit 212ba5c

Please sign in to comment.