diff --git a/src/screens/OrganizationDashboard/OrganizationDashboard.test.tsx b/src/screens/OrganizationDashboard/OrganizationDashboard.test.tsx index 568d5e6bc9..f1bde5c5a5 100644 --- a/src/screens/OrganizationDashboard/OrganizationDashboard.test.tsx +++ b/src/screens/OrganizationDashboard/OrganizationDashboard.test.tsx @@ -147,25 +147,52 @@ describe('Organisation Dashboard Page', () => { expect(window.location).toBeAt('/orglist'); }); - test('rendering of upcoming events', async () => { - render( - - - - - - - - - - ); + test('Testing empty membership requests and upcoming events with populated posts', async () => { + await act(async () => { + render( + + + + + + + + + + ); + }); await wait(); - const upcomingEventsTitle = screen.getByText('Upcoming Events'); - expect(upcomingEventsTitle).toBeInTheDocument(); + const viewMSBtn = screen.getByTestId('viewAllMembershipRequests'); + + fireEvent.click(viewMSBtn); + expect(toast.success).toBeCalledWith('Coming soon!'); + + expect( + screen.getByText(/No Membership requests present/i) + ).toBeInTheDocument(); + expect(screen.getByText(/No Upcoming Events/i)).toBeInTheDocument(); + expect(screen.queryByText(/No Posts Present/i)).toBeInTheDocument(); + }); + + test('Testing error scenario redirects to orglist page', async () => { + await act(async () => { + render( + + + + + + + + + + ); + }); + + await wait(); - const upcomingEvents = screen.queryAllByTestId('upcomingEventItem'); - expect(upcomingEvents.length).toBeGreaterThanOrEqual(0); + expect(window.location.pathname).toBe('/orglist'); }); });