Skip to content

Commit d31b034

Browse files
committed
Merge remote-tracking branch 'upstream/develop-postgres' into issue-2936
2 parents 38d1286 + 6997a04 commit d31b034

13 files changed

+764
-231
lines changed

src/components/AgendaCategory/AgendaCategoryContainer.test.tsx renamed to src/components/AgendaCategory/AgendaCategoryContainer.spec.tsx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,7 @@ import {
88
fireEvent,
99
} from '@testing-library/react';
1010
import userEvent from '@testing-library/user-event';
11-
import 'jest-localstorage-mock';
1211
import { MockedProvider } from '@apollo/client/testing';
13-
import 'jest-location-mock';
1412
import { I18nextProvider } from 'react-i18next';
1513
import { Provider } from 'react-redux';
1614
import { BrowserRouter } from 'react-router-dom';
@@ -25,14 +23,15 @@ import { StaticMockLink } from 'utils/StaticMockLink';
2523
import AgendaCategoryContainer from './AgendaCategoryContainer';
2624
import { props, props2 } from './AgendaCategoryContainerProps';
2725
import { MOCKS, MOCKS_ERROR_MUTATIONS } from './AgendaCategoryContainerMocks';
26+
import { vi, describe, test, expect } from 'vitest';
2827

2928
const link = new StaticMockLink(MOCKS, true);
3029
const link2 = new StaticMockLink(MOCKS_ERROR_MUTATIONS, true);
3130

32-
jest.mock('react-toastify', () => ({
31+
vi.mock('react-toastify', () => ({
3332
toast: {
34-
success: jest.fn(),
35-
error: jest.fn(),
33+
success: vi.fn(),
34+
error: vi.fn(),
3635
},
3736
}));
3837

src/components/AgendaCategory/AgendaCategoryContainerProps.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
type AgendaCategoryConnectionType = 'Organization';
2+
import { vi } from 'vitest';
23

34
export const props = {
45
agendaCategoryConnection: 'Organization' as AgendaCategoryConnectionType,
@@ -24,11 +25,11 @@ export const props = {
2425
},
2526
},
2627
],
27-
agendaCategoryRefetch: jest.fn(),
28+
agendaCategoryRefetch: vi.fn(),
2829
};
2930

3031
export const props2 = {
3132
agendaCategoryConnection: 'Organization' as AgendaCategoryConnectionType,
3233
agendaCategoryData: [],
33-
agendaCategoryRefetch: jest.fn(),
34+
agendaCategoryRefetch: vi.fn(),
3435
};

src/components/EventCalendar/EventCalendar.test.tsx renamed to src/components/EventCalendar/EventCalendar.spec.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import i18nForTest from 'utils/i18nForTest';
1313
import { StaticMockLink } from 'utils/StaticMockLink';
1414
import { weekdays, months } from './constants';
1515
import { BrowserRouter as Router } from 'react-router-dom';
16+
import { vi } from 'vitest';
1617

1718
const eventData = [
1819
{
@@ -122,7 +123,7 @@ describe('Calendar', () => {
122123
});
123124

124125
afterEach(() => {
125-
jest.clearAllMocks();
126+
vi.clearAllMocks();
126127
});
127128

128129
it('should render the current month and year', () => {

src/components/EventCalendar/EventHeader.test.tsx renamed to src/components/EventCalendar/EventHeader.spec.tsx

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,20 @@ import EventHeader from './EventHeader';
44
import { ViewType } from '../../screens/OrganizationEvents/OrganizationEvents';
55
import { I18nextProvider } from 'react-i18next';
66
import i18nForTest from 'utils/i18nForTest';
7+
import { vi } from 'vitest';
78

89
describe('EventHeader Component', () => {
910
const viewType = ViewType.MONTH;
10-
const handleChangeView = jest.fn();
11-
const showInviteModal = jest.fn();
11+
12+
/**
13+
* Mock function to handle view type changes.
14+
*/
15+
const handleChangeView = vi.fn();
16+
17+
/**
18+
* Mock function to handle the display of the invite modal.
19+
*/
20+
const showInviteModal = vi.fn();
1221

1322
it('renders correctly', () => {
1423
const { getByTestId } = render(

src/components/MemberDetail/EventsAttendedCardItem.test.tsx renamed to src/components/MemberDetail/EventsAttendedCardItem.spec.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React from 'react';
22
import { render, screen } from '@testing-library/react';
33
import { BrowserRouter } from 'react-router-dom';
44
import EventAttendedCard from './EventsAttendedCardItem';
5+
import { vi } from 'vitest';
56

67
interface InterfaceEventAttendedCardProps {
78
type: 'Event';
@@ -33,7 +34,7 @@ describe('EventAttendedCard', () => {
3334
};
3435

3536
beforeEach(() => {
36-
jest.clearAllMocks();
37+
vi.clearAllMocks();
3738
});
3839

3940
it('renders event details correctly', () => {

src/components/MemberDetail/EventsAttendedMemberModal.test.tsx renamed to src/components/MemberDetail/EventsAttendedMemberModal.spec.tsx

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,24 @@ import { render, screen, fireEvent } from '@testing-library/react';
33
import { MockedProvider } from '@apollo/client/testing';
44
import { BrowserRouter } from 'react-router-dom';
55
import EventsAttendedMemberModal from './EventsAttendedMemberModal';
6+
import { vi } from 'vitest';
67

7-
jest.mock('react-i18next', () => ({
8+
/**
9+
* Mock the `react-i18next` module to provide translation functionality.
10+
*/
11+
12+
vi.mock('react-i18next', () => ({
813
useTranslation: () => ({
914
t: (key: string) => key,
1015
i18n: { changeLanguage: () => Promise.resolve() },
1116
}),
1217
}));
1318

14-
jest.mock('./customTableCell', () => ({
19+
/**
20+
* Mock the `CustomTableCell` component for testing.
21+
*/
22+
23+
vi.mock('./customTableCell', () => ({
1524
CustomTableCell: ({ eventId }: { eventId: string }) => (
1625
<tr data-testid="event-row">
1726
<td>{`Event ${eventId}`}</td>
@@ -33,12 +42,12 @@ const mockEvents = Array.from({ length: 6 }, (_, index) => ({
3342
describe('EventsAttendedMemberModal', () => {
3443
const defaultProps = {
3544
eventsAttended: mockEvents,
36-
setShow: jest.fn(),
45+
setShow: vi.fn(),
3746
show: true,
3847
};
3948

4049
beforeEach(() => {
41-
jest.clearAllMocks();
50+
vi.clearAllMocks();
4251
});
4352

4453
test('renders modal with correct title when show is true', () => {
@@ -95,7 +104,7 @@ describe('EventsAttendedMemberModal', () => {
95104
});
96105

97106
test('closes modal when close button is clicked', () => {
98-
const mockSetShow = jest.fn();
107+
const mockSetShow = vi.fn();
99108
render(
100109
<MockedProvider>
101110
<BrowserRouter>

src/components/OrgContriCards/OrgContriCards.test.tsx renamed to src/components/OrgContriCards/OrgContriCards.spec.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import { I18nextProvider } from 'react-i18next';
77
import OrgContriCards from './OrgContriCards';
88
import i18nForTest from 'utils/i18nForTest';
99
import { BACKEND_URL } from 'Constant/constant';
10-
10+
import { describe, expect } from 'vitest';
1111
const client: ApolloClient<NormalizedCacheObject> = new ApolloClient({
1212
cache: new InMemoryCache(),
1313
uri: BACKEND_URL,

src/screens/MemberDetail/MemberDetail.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { useMutation, useQuery } from '@apollo/client';
33
import Button from 'react-bootstrap/Button';
44
import { useTranslation } from 'react-i18next';
55
import { useLocation, useNavigate, useParams } from 'react-router-dom';
6-
import styles from './MemberDetail.module.css';
6+
import styles from '../../style/app.module.css';
77
import { languages } from 'utils/languages';
88
import { UPDATE_USER_MUTATION } from 'GraphQl/Mutations/mutations';
99
import { USER_DETAILS } from 'GraphQl/Queries/Queries';
@@ -433,7 +433,7 @@ const MemberDetail: React.FC<MemberDetailProps> = ({ id }): JSX.Element => {
433433
{t('birthDate')}
434434
</label>
435435
<DatePicker
436-
className={`${styles.datebox} w-100`}
436+
className={`${styles.dateboxMemberDetail} w-100`}
437437
value={dayjs(formState.birthDate)}
438438
onChange={handleDateChange}
439439
data-testid="birthDate"

src/screens/OrganizationFundCampaign/CampaignModal.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import type { ChangeEvent } from 'react';
55
import React, { useEffect, useState } from 'react';
66
import { Button, Form, Modal } from 'react-bootstrap';
77
import { currencyOptions, currencySymbols } from 'utils/currency';
8-
import styles from './OrganizationFundCampaign.module.css';
8+
import styles from '../../style/app.module.css';
99
import { useTranslation } from 'react-i18next';
1010
import { useMutation } from '@apollo/client';
1111
import {
@@ -301,7 +301,7 @@ const CampaignModal: React.FC<InterfaceCampaignModal> = ({
301301
{/* Button to create the campaign */}
302302
<Button
303303
type="submit"
304-
className={styles.greenregbtn}
304+
className={styles.greenregbtnOrganizationFundCampaign}
305305
data-testid="submitCampaignBtn"
306306
>
307307
{t(mode === 'edit' ? 'updateCampaign' : 'createCampaign')}

src/screens/OrganizationFundCampaign/OrganizationFundCampagins.tsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import dayjs from 'dayjs';
1414
import Loader from 'components/Loader/Loader';
1515
import CampaignModal from './CampaignModal';
1616
import { FUND_CAMPAIGN } from 'GraphQl/Queries/fundQueries';
17-
import styles from './OrganizationFundCampaign.module.css';
17+
import styles from '../../style/app.module.css';
1818
import { currencySymbols } from 'utils/currency';
1919
import type {
2020
InterfaceCampaignInfo,
@@ -339,14 +339,14 @@ const orgFundCampaign = (): JSX.Element => {
339339
<Typography color="text.primary">{t('title')}</Typography>
340340
</Breadcrumbs>
341341

342-
<div className={styles.btnsContainer}>
343-
<div className={styles.input}>
342+
<div className={styles.btnsContainerOrganizationFundCampaign}>
343+
<div className={styles.inputOrganizationFundCampaign}>
344344
<Form.Control
345345
type="name"
346346
placeholder={tCommon('searchByName')}
347347
autoComplete="off"
348348
required
349-
className={styles.inputField}
349+
className={styles.inputFieldOrganizationFundCampaign}
350350
value={searchTerm}
351351
onChange={(e) => setSearchTerm(e.target.value)}
352352
data-testid="searchFullName"
@@ -358,13 +358,13 @@ const orgFundCampaign = (): JSX.Element => {
358358
<Search />
359359
</Button>
360360
</div>
361-
<div className={styles.btnsBlock}>
361+
<div className={styles.btnsBbtnsBlockOrganizationFundCampaignlock}>
362362
<div className="d-flex justify-space-between">
363363
<Dropdown>
364364
<Dropdown.Toggle
365365
variant="success"
366366
id="dropdown-basic"
367-
className={styles.dropdown}
367+
className={styles.dropdownOrganizationFundCampaign}
368368
data-testid="filter"
369369
>
370370
<Sort className={'me-1'} />
@@ -426,7 +426,9 @@ const orgFundCampaign = (): JSX.Element => {
426426
),
427427
}}
428428
sx={dataGridStyle}
429-
getRowClassName={() => `${styles.rowBackground}`}
429+
getRowClassName={() =>
430+
`${styles.rowBackgroundOrganizationFundCampaign}`
431+
}
430432
autoHeight
431433
rowHeight={65}
432434
rows={campaigns.map((campaign, index) => ({

0 commit comments

Comments
 (0)