Skip to content

Commit

Permalink
fix: Removed redundancy
Browse files Browse the repository at this point in the history
- Removed the new interface instead imported the existing interface.
- Added cleanup function in tests.

Signed-off-by: Akhilender <[email protected]>
  • Loading branch information
akhilender-bongirwar committed Dec 5, 2023
1 parent ba4f4bf commit 31b547e
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 14 deletions.
10 changes: 9 additions & 1 deletion src/screens/OrgList/OrgList.test.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
import React from 'react';
import { MockedProvider } from '@apollo/react-testing';
import { act, render, screen, fireEvent } from '@testing-library/react';
import {
act,
render,
screen,
fireEvent,
cleanup,
} from '@testing-library/react';
import userEvent from '@testing-library/user-event';
import 'jest-localstorage-mock';
import 'jest-location-mock';
Expand All @@ -11,6 +17,7 @@ import { store } from 'state/store';
import { StaticMockLink } from 'utils/StaticMockLink';
import i18nForTest from 'utils/i18nForTest';
import OrgList from './OrgList';

import { MOCKS, MOCKS_ADMIN, MOCKS_EMPTY } from './OrgListMocks';

async function wait(ms = 100): Promise<void> {
Expand All @@ -23,6 +30,7 @@ async function wait(ms = 100): Promise<void> {

afterEach(() => {
localStorage.clear();
cleanup();
});

describe('Organisations Page testing as SuperAdmin', () => {
Expand Down
15 changes: 2 additions & 13 deletions src/screens/OrgList/OrgList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,6 @@ import type {
} from 'utils/interfaces';
import styles from './OrgList.module.css';

interface InterfaceOrgList {
_id: string;
name: string;
image: string | null;
location: string;
admins: { _id: string }[];
members: { _id: string }[];
creator: { _id: string; firstName: string; lastName: string };
createdAt: string;
}

function orgList(): JSX.Element {
const { t } = useTranslation('translation', { keyPrefix: 'orgList' });
const [dialogModalisOpen, setdialogModalIsOpen] = useState(false);
Expand Down Expand Up @@ -299,9 +288,9 @@ function orgList(): JSX.Element {
};

const sortOrgs = (
orgs: InterfaceOrgList[],
orgs: InterfaceOrgConnectionInfoType[],
sortingOption: string
): InterfaceOrgList[] => {
): InterfaceOrgConnectionInfoType[] => {
const sortedOrgs = [...orgs];

if (sortingOption === 'latest') {
Expand Down

0 comments on commit 31b547e

Please sign in to comment.