From 702cbe067610b5883f56590e2c7f693343f00d60 Mon Sep 17 00:00:00 2001 From: gauravsingh94 Date: Fri, 5 Jan 2024 21:43:17 +0530 Subject: [PATCH] Fixed-Issue-#1266 Bug Report When a new post is added, the latest post section in the organization's dashboard becomes distorted Updated --- .../OrganizationDashboard.test.tsx | 59 ++++++++++++++----- 1 file changed, 43 insertions(+), 16 deletions(-) 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'); }); });