diff --git a/src/screens/OrganizationDashboard/OrganizationDashboard.test.tsx b/src/screens/OrganizationDashboard/OrganizationDashboard.test.tsx index a7a7fe2fd1..8e61b552ed 100644 --- a/src/screens/OrganizationDashboard/OrganizationDashboard.test.tsx +++ b/src/screens/OrganizationDashboard/OrganizationDashboard.test.tsx @@ -9,7 +9,12 @@ import { BrowserRouter } from 'react-router-dom'; import { store } from 'state/store'; import { StaticMockLink } from 'utils/StaticMockLink'; import OrganizationDashboard from './OrganizationDashboard'; -import { EMPTY_MOCKS, ERROR_MOCKS, MOCKS } from './OrganizationDashboardMocks'; +import { + EMPTY_MOCKS, + ERROR_MOCKS, + MOCKS, + EVENT_MOCK, +} from './OrganizationDashboardMocks'; import i18nForTest from 'utils/i18nForTest'; import { toast } from 'react-toastify'; import userEvent from '@testing-library/user-event'; @@ -24,6 +29,7 @@ async function wait(ms = 100): Promise { const link1 = new StaticMockLink(MOCKS, true); const link2 = new StaticMockLink(EMPTY_MOCKS, true); const link3 = new StaticMockLink(ERROR_MOCKS, true); +const link4 = new StaticMockLink(EVENT_MOCK, true); jest.mock('react-toastify', () => ({ toast: { @@ -219,4 +225,23 @@ describe('Organisation Dashboard Page', () => { // Ensure that toast.success is called with 'Coming soon!' expect(toast.success).toBeCalledWith('Coming soon!'); }); + + test('Checking for Upcoming Event is getting rendered or not.', async () => { + await act(async () => { + render( + + + + + + + + + + ); + }); + + await wait(); + expect(screen.getByText('Sample Event')).toBeInTheDocument(); + }); }); diff --git a/src/screens/OrganizationDashboard/OrganizationDashboardMocks.ts b/src/screens/OrganizationDashboard/OrganizationDashboardMocks.ts index dc1f158709..1ab2b298b8 100644 --- a/src/screens/OrganizationDashboard/OrganizationDashboardMocks.ts +++ b/src/screens/OrganizationDashboard/OrganizationDashboardMocks.ts @@ -260,6 +260,37 @@ export const EMPTY_MOCKS = [ }, ]; +export const EVENT_MOCK = [ + { + request: { + query: ORGANIZATION_EVENT_CONNECTION_LIST, + variables: { + organization_id: '6437904485008f171cf29924', + }, + }, + result: { + data: { + eventsByOrganizationConnection: [ + { + _id: '1', + title: 'Sample Event', + description: 'Sample Description', + startDate: '2023-10-29T00:00:00.000Z', + endDate: '2023-10-29T23:59:59.000Z', + location: 'Sample Location', + startTime: '08:00:00', + endTime: '17:00:00', + allDay: false, + recurring: false, + isPublic: true, + isRegisterable: true, + }, + ], + }, + }, + }, +]; + export const ERROR_MOCKS = [ { request: {