Skip to content

Commit

Permalink
Fixed-Issue-PalisadoesFoundation#1266 Bug Report When a new post is a…
Browse files Browse the repository at this point in the history
…dded, the latest post section in the organization's dashboard becomes distorted Updated
  • Loading branch information
gauravsingh94 committed Jan 5, 2024
1 parent 5945392 commit 702cbe0
Showing 1 changed file with 43 additions and 16 deletions.
59 changes: 43 additions & 16 deletions src/screens/OrganizationDashboard/OrganizationDashboard.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -147,25 +147,52 @@ describe('Organisation Dashboard Page', () => {
expect(window.location).toBeAt('/orglist');
});

test('rendering of upcoming events', async () => {
render(
<MockedProvider addTypename={false} link={link1}>
<BrowserRouter>
<Provider store={store}>
<I18nextProvider i18n={i18nForTest}>
<OrganizationDashboard />
</I18nextProvider>
</Provider>
</BrowserRouter>
</MockedProvider>
);
test('Testing empty membership requests and upcoming events with populated posts', async () => {
await act(async () => {
render(
<MockedProvider addTypename={false} link={link2}>
<BrowserRouter>
<Provider store={store}>
<I18nextProvider i18n={i18nForTest}>
<OrganizationDashboard />
</I18nextProvider>
</Provider>
</BrowserRouter>
</MockedProvider>
);
});

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(
<MockedProvider addTypename={false} link={link3}>
<BrowserRouter>
<Provider store={store}>
<I18nextProvider i18n={i18nForTest}>
<OrganizationDashboard />
</I18nextProvider>
</Provider>
</BrowserRouter>
</MockedProvider>
);
});

await wait();

const upcomingEvents = screen.queryAllByTestId('upcomingEventItem');
expect(upcomingEvents.length).toBeGreaterThanOrEqual(0);
expect(window.location.pathname).toBe('/orglist');
});
});

0 comments on commit 702cbe0

Please sign in to comment.