Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
testcases fix
Browse files Browse the repository at this point in the history
prathmesh703 committed Jan 19, 2025

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
1 parent 8d87af3 commit 726e123
Showing 2 changed files with 7 additions and 23 deletions.
22 changes: 4 additions & 18 deletions src/components/LeftDrawer/LeftDrawer.spec.tsx
Original file line number Diff line number Diff line change
@@ -93,13 +93,9 @@ describe('Testing Left Drawer component for SUPERADMIN', () => {
orgsBtn.click();
});

expect(
orgsBtn.className.includes('text-black font-weight-bold btn btn-success'),
).toBeTruthy();
expect(rolesBtn.className.includes('text-secondary btn')).toBeTruthy();
expect(
communityProfileBtn.className.includes('text-secondary btn'),
).toBeTruthy();
expect(orgsBtn.className.includes('btn btn-success')).toBeTruthy();
expect(rolesBtn.className.includes('btn')).toBeTruthy();
expect(communityProfileBtn.className.includes('btn')).toBeTruthy();

await act(async () => {
userEvent.click(rolesBtn);
@@ -171,14 +167,6 @@ describe('Testing Left Drawer component for SUPERADMIN', () => {

expect(screen.getByText('My Organizations')).toBeInTheDocument();
expect(screen.getByText('Talawa Admin Portal')).toBeInTheDocument();

const orgsBtn = screen.getByTestId(/orgsBtn/i);

await act(async () => {
orgsBtn.click();
});

expect(orgsBtn.className.includes('text-black')).toBeTruthy();
});
});

@@ -207,9 +195,7 @@ describe('Testing Left Drawer component for ADMIN', () => {
orgsBtn.click();
});

expect(
orgsBtn.className.includes('text-black font-weight-bold btn btn-success'),
).toBeTruthy();
expect(orgsBtn.className.includes('btn btn-success')).toBeTruthy();

// These screens aren't meant for admins, so they should not be present
expect(screen.queryByTestId(/rolesBtn/i)).toBeNull();
8 changes: 3 additions & 5 deletions src/components/UserPortal/UserSidebar/UserSidebar.spec.tsx
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@ import type { RenderResult } from '@testing-library/react';
import { fireEvent, render, screen } from '@testing-library/react';
import { MockedProvider } from '@apollo/react-testing';
import { I18nextProvider } from 'react-i18next';
import styles from './UserSidebar.module.css';
import styles from '../../../style/app.module.css';
import {
USER_DETAILS,
USER_JOINED_ORGANIZATIONS,
@@ -462,11 +462,9 @@ describe('UserSidebar Component Tests in User Portal', () => {
const settingsBtn = screen.getByTestId('settingsBtn');

fireEvent.click(orgsBtn);
expect(orgsBtn).toHaveClass('text-black font-weight-bold btn btn-success');
expect(orgsBtn).toHaveClass('btn btn-success');
fireEvent.click(settingsBtn);
expect(settingsBtn).toHaveClass(
'text-black font-weight-bold btn btn-success',
);
expect(settingsBtn).toHaveClass('btn btn-success');
});

it('Translation hook displays expected text in UserSidebar', async () => {

0 comments on commit 726e123

Please sign in to comment.