diff --git a/src/App.test.tsx b/src/App.spec.tsx
similarity index 70%
rename from src/App.test.tsx
rename to src/App.spec.tsx
index f4fba2ebf8..45b73943cf 100644
--- a/src/App.test.tsx
+++ b/src/App.spec.tsx
@@ -1,25 +1,27 @@
-import React, { act } from 'react';
+import React from 'react';
import { render, screen } from '@testing-library/react';
import { Provider } from 'react-redux';
import { MockedProvider } from '@apollo/react-testing';
import { BrowserRouter } from 'react-router-dom';
import { I18nextProvider } from 'react-i18next';
-import 'jest-location-mock';
+import { describe, it, expect, vi } from 'vitest';
import App from './App';
import { store } from 'state/store';
import { CHECK_AUTH } from 'GraphQl/Queries/Queries';
import i18nForTest from './utils/i18nForTest';
import { StaticMockLink } from 'utils/StaticMockLink';
-import useLocalStorage from 'utils/useLocalstorage';
-const { setItem } = useLocalStorage();
+vi.mock('@mui/x-charts/PieChart', () => ({
+ pieArcLabelClasses: vi.fn(),
+ PieChart: vi.fn().mockImplementation(() => <>Test>),
+ pieArcClasses: vi.fn(),
+}));
-// Mock the modules for PieChart rendering as they require a trasformer being used (which is not done by Jest)
-// These modules are used by the Feedback components
-jest.mock('@mui/x-charts/PieChart', () => ({
- pieArcLabelClasses: jest.fn(),
- PieChart: jest.fn().mockImplementation(() => <>Test>),
- pieArcClasses: jest.fn(),
+vi.mock('/src/assets/svgs/palisadoes.svg?react', () => ({
+ default: () => ,
+}));
+vi.mock('/src/assets/svgs/talawa.svg?react', () => ({
+ default: () => ,
}));
const MOCKS = [
@@ -59,16 +61,13 @@ const link = new StaticMockLink(MOCKS, true);
const link2 = new StaticMockLink([], true);
async function wait(ms = 100): Promise {
- await act(() => {
- return new Promise((resolve) => {
- setTimeout(resolve, ms);
- });
+ await new Promise((resolve) => {
+ setTimeout(resolve, ms);
});
}
describe('Testing the App Component', () => {
- test('Component should be rendered properly and user is loggedin', async () => {
- setItem('AdminFor', [{ name: 'adi', _id: '1234', image: '' }]);
+ it('Component should be rendered properly and user is logged in', async () => {
render(
@@ -83,9 +82,9 @@ describe('Testing the App Component', () => {
await wait();
- window.location.assign('/orglist');
+ window.history.pushState({}, '', '/orglist');
await wait();
- expect(window.location).toBeAt('/orglist');
+ expect(window.location.pathname).toBe('/orglist');
expect(
screen.getByText(
'An open source application by Palisadoes Foundation volunteers',
@@ -93,7 +92,7 @@ describe('Testing the App Component', () => {
).toBeTruthy();
});
- test('Component should be rendered properly and user is loggedout', async () => {
+ it('Component should be rendered properly and user is logged out', async () => {
render(
diff --git a/src/App.tsx b/src/App.tsx
index 4d2ca76010..7ba6054a66 100644
--- a/src/App.tsx
+++ b/src/App.tsx
@@ -30,7 +30,7 @@ import CommunityProfile from 'screens/CommunityProfile/CommunityProfile';
import OrganizationVenues from 'screens/OrganizationVenues/OrganizationVenues';
import Leaderboard from 'screens/Leaderboard/Leaderboard';
-import React, { useEffect } from 'react';
+import React from 'react';
// User Portal Components
import Donate from 'screens/UserPortal/Donate/Donate';
import Events from 'screens/UserPortal/Events/Events';
@@ -39,20 +39,15 @@ import Organizations from 'screens/UserPortal/Organizations/Organizations';
import People from 'screens/UserPortal/People/People';
import Settings from 'screens/UserPortal/Settings/Settings';
import Chat from 'screens/UserPortal/Chat/Chat';
-import { useQuery } from '@apollo/client';
-import { CHECK_AUTH } from 'GraphQl/Queries/Queries';
import Advertisements from 'components/Advertisements/Advertisements';
import SecuredRouteForUser from 'components/UserPortal/SecuredRouteForUser/SecuredRouteForUser';
-
-import useLocalStorage from 'utils/useLocalstorage';
import UserScreen from 'screens/UserPortal/UserScreen/UserScreen';
import EventDashboardScreen from 'components/EventDashboardScreen/EventDashboardScreen';
import Campaigns from 'screens/UserPortal/Campaigns/Campaigns';
import Pledges from 'screens/UserPortal/Pledges/Pledges';
import VolunteerManagement from 'screens/UserPortal/Volunteer/VolunteerManagement';
-import LeaveOrganization from 'screens/UserPortal/LeaveOrganization/LeaveOrganization';
-const { setItem } = useLocalStorage();
+// const { setItem } = useLocalStorage();
/**
* This is the main function for our application. It sets up all the routes and components,
@@ -97,20 +92,20 @@ function app(): JSX.Element {
// TODO: Fetch Installed plugin extras and store for use within MainContent and Side Panel Components.
- const { data, loading } = useQuery(CHECK_AUTH);
+ // const { data, loading } = useQuery(CHECK_AUTH);
- useEffect(() => {
- if (data) {
- setItem('name', `${data.checkAuth.firstName} ${data.checkAuth.lastName}`);
- setItem('id', data.checkAuth._id);
- setItem('email', data.checkAuth.email);
- setItem('IsLoggedIn', 'TRUE');
- setItem('FirstName', data.checkAuth.firstName);
- setItem('LastName', data.checkAuth.lastName);
- setItem('UserImage', data.checkAuth.image);
- setItem('Email', data.checkAuth.email);
- }
- }, [data, loading]);
+ // useEffect(() => {
+ // if (data) {
+ // setItem('name', `${data.checkAuth.firstName} ${data.checkAuth.lastName}`);
+ // setItem('id', data.checkAuth._id);
+ // setItem('email', data.checkAuth.email);
+ // setItem('IsLoggedIn', 'TRUE');
+ // setItem('FirstName', data.checkAuth.firstName);
+ // setItem('LastName', data.checkAuth.lastName);
+ // setItem('UserImage', data.checkAuth.image);
+ // setItem('Email', data.checkAuth.email);
+ // }
+ // }, [data, loading]);
const extraRoutes = Object.entries(installedPlugins).map(
(
@@ -199,10 +194,6 @@ function app(): JSX.Element {
} />
} />
} />
- }
- />
}
@@ -215,7 +206,6 @@ function app(): JSX.Element {
- {/* */}
} />
>