Skip to content

Commit

Permalink
Fixed OrgList and OrgListCard Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JamarTG committed Nov 14, 2023
1 parent aa7fb35 commit 9ed11bd
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 16 deletions.
3 changes: 2 additions & 1 deletion public/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,8 @@
"manageFeaturesInfo": "Creation Successful ! Please select features that you want to enale for this organization from the plugin store.",
"goToStore": "Go to Plugin Store",
"enableEverything": "Enable Everything",
"noResultsFoundFor": "No results found for"
"noResultsFoundFor": "No results found for",
"OR": "OR"
},
"orgListCard": {
"admins": "Admins",
Expand Down
3 changes: 2 additions & 1 deletion public/locales/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@
"noOrgErrorTitle": "Organisations non trouvées",
"sampleOrgDuplicate": "Seule une organisation d'exemple est autorisée.",
"noOrgErrorDescription": "Veuillez créer une organisation via le tableau de bord",
"noResultsFoundFor": "Aucun résultat trouvé pour "
"noResultsFoundFor": "Aucun résultat trouvé pour ",
"OR": "OU"
},
"orgListCard": {
"admins": "Administrateurs",
Expand Down
3 changes: 2 additions & 1 deletion public/locales/hi.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@
"noOrgErrorTitle": "संगठन नहीं मिला",
"sampleOrgDuplicate": "केवल एक नमूना संगठन को अनुमति दी गई",
"noOrgErrorDescription": "कृपया डैशबोर्ड के माध्यम से एक संगठन बनाएं",
"noResultsFoundFor": "के लिए कोई परिणाम नहीं मिला "
"noResultsFoundFor": "के लिए कोई परिणाम नहीं मिला ",
"OR": "या"
},
"orgListCard": {
"admins": "व्यवस्थापक",
Expand Down
3 changes: 2 additions & 1 deletion public/locales/sp.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@
"noOrgErrorTitle": "Organizaciones no encontradas",
"sampleOrgDuplicate": "Solo se permite una organización de muestra",
"noOrgErrorDescription": "Por favor, crea una organización a través del panel de control",
"noResultsFoundFor": "No se encontraron resultados para "
"noResultsFoundFor": "No se encontraron resultados para ",
"OR": "O"
},
"orgListCard": {
"admins": "Administradores",
Expand Down
3 changes: 2 additions & 1 deletion public/locales/zh.json
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,8 @@
"noOrgErrorTitle": "找不到组织",
"sampleOrgDuplicate": "只允许一个样本组织",
"noOrgErrorDescription": "请通过仪表板创建一个组织",
"noResultsFoundFor": "未找到结果 "
"noResultsFoundFor": "未找到结果 ",
"OR": "或者"
},
"orgListCard": {
"admins": "管理員",
Expand Down
12 changes: 7 additions & 5 deletions src/screens/OrgList/OrgList.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ afterEach(() => {
});

describe('Organisations Page testing as SuperAdmin', () => {
localStorage.setItem('id', '123');

const link = new StaticMockLink(MOCKS, true);
const link2 = new StaticMockLink(MOCKS_EMPTY, true);

Expand Down Expand Up @@ -74,10 +76,10 @@ describe('Organisations Page testing as SuperAdmin', () => {
);

await wait();
expect(container.textContent).toMatch('Organizations Not Found');
expect(container.textContent).toMatch(
'Please create an organization through dashboard'
);
expect(screen.queryByText('Organizations Not Found')).toBeInTheDocument();
expect(
screen.queryByText('Please create an organization through dashboard')
).toBeInTheDocument();
expect(window.location).toBeAt('/');
});

Expand Down Expand Up @@ -114,7 +116,7 @@ describe('Organisations Page testing as SuperAdmin', () => {
const createOrgBtn = screen.getByTestId(/createOrganizationBtn/i);
expect(createOrgBtn).toBeInTheDocument();
userEvent.click(createOrgBtn);
userEvent.click(screen.getByTestId(/closeOrganizationModal/i));
userEvent.click(screen.getByTestId(/closeModalBtn/i));
});

test('Create organization model should work properly', async () => {
Expand Down
8 changes: 2 additions & 6 deletions src/screens/OrgList/OrgList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,7 @@ function orgList(): JSX.Element {
}, []);

useEffect(() => {
if (loading && isLoadingMore == false) {
setIsLoading(true);
} else {
setIsLoading(false);
}
setIsLoading(loading && isLoadingMore);
}, [loading]);

/* istanbul ignore next */
Expand Down Expand Up @@ -571,7 +567,7 @@ function orgList(): JSX.Element {

<div className="position-relative">
<hr />
<span className={styles.orText}>OR</span>
<span className={styles.orText}>{t('OR')}</span>
</div>
{userData &&
((userData.user.userType === 'ADMIN' &&
Expand Down

0 comments on commit 9ed11bd

Please sign in to comment.