Skip to content

Commit

Permalink
fixed failing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Doraemon012 committed Sep 29, 2024
1 parent 392ab42 commit 9d7f9dd
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 24 deletions.
6 changes: 4 additions & 2 deletions public/locales/fr/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,8 @@
"talawaApiUnavailable": "API Talawa indisponible"
},
"organizationPeople": {
"title": "Membres Talawa",
"title": "Membres",
"title_superadmin": "Utilisateurs",
"filterByName": "Filtrer par nom",
"filterByLocation": "Filtrer par emplacement",
"filterByEvent": "Filtrer par événement",
Expand Down Expand Up @@ -878,7 +879,8 @@
"organizations": "Organisations",
"events": "Événements",
"tags": "Balises",
"title": "Détails de l'utilisateur"
"title_superadmin": "Détails de l'utilisateur",
"title": "Détails du membre"
},
"orgMemberDetail": {
"title": "Détails de l'utilisateur",
Expand Down
6 changes: 4 additions & 2 deletions public/locales/hi/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,8 @@
"talawaApiUnavailable": "तालावा एपीआई अनुपलब्ध"
},
"organizationPeople": {
"title": "तालावा सदस्य",
"title": "सदस्य",
"title_superadmin": "उपयोगकर्ता",
"filterByName": "नाम से फ़िल्टर करें",
"filterByLocation": "स्थान से फ़िल्टर करें",
"filterByEvent": "घटना से फ़िल्टर करें",
Expand Down Expand Up @@ -878,7 +879,8 @@
"organizations": "संगठन",
"events": "घटनाएँ",
"tags": "टैग",
"title": "उपयोगकर्ता विवरण"
"title_superadmin": "उपयोगकर्ता विवरण",
"title": "सदस्य विवरण"
},
"orgMemberDetail": {
"title": "उपयोगकर्ता विवरण",
Expand Down
8 changes: 3 additions & 5 deletions public/locales/sp/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -623,7 +623,6 @@
"raisedAmount": "Monto recaudado",
"pledgedAmount": "Monto comprometido"
},

"orgPost": {
"title": "Publicaciones de Talawa",
"searchPost": "Buscar Publicación",
Expand Down Expand Up @@ -880,15 +879,14 @@
"organizations": "Organizaciones",
"events": "Eventos",
"tags": "Etiquetas",
"title": "Detalles del Usuario"
"title_superadmin": "Detalles del usuario",
"title": "Detalles del miembro"
},
"memberOrganization": {
"sort": "Ordenar",
"noOrgError": "Organizaciones no encontradas, por favor crea una organización a través del panel de control",
"noOrgErrorTitle": "Organizaciones no encontradas",
"noOrgErrorDescription": "Por favor, crea una organización a través del panel de control",
"noResultsFoundFor": "No se encontraron resultados para",
"endOfResults": "Fin de los resultados"
"noOrgErrorDescription": "Por favor, crea una organización a través del panel de control"
},
"orgMemberDetail": {
"title": "Detalles del usuario",
Expand Down
6 changes: 3 additions & 3 deletions public/locales/zh/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,7 @@
},
"organizationPeople": {
"title": "塔拉瓦会员",
"title_superadmin": "塔拉瓦用户",
"filterByName": "按名称过滤",
"filterByLocation": "按地点过滤",
"filterByEvent": "按事件过滤",
Expand Down Expand Up @@ -878,9 +879,9 @@
"organizations": "组织",
"events": "活动",
"tags": "标签",
"title": "用户详情"
"title_superadmin": "用户详情",
"title": "成员详情"
},

"orgMemberDetail": {
"title": "用户详情",
"addAdmin": "添加管理员",
Expand Down Expand Up @@ -923,7 +924,6 @@
"joined": "已加入",
"talawaApiUnavailable": "塔拉瓦 API 不可用"
},

"memberOrganization": {
"sort": "按角色搜索",
"noOrgError": "未找到组织,请通过仪表板创建组织",
Expand Down
43 changes: 31 additions & 12 deletions src/screens/MemberDetail/MemberDetail.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,9 @@ describe('MemberDetail', () => {
global.alert = jest.fn();

test('Should render the elements', async () => {
renderMemberDetail();
await act(async () => {
renderMemberDetail();
});

await waitFor(() => {
expect(screen.getByTestId('container')).toBeInTheDocument();
Expand All @@ -153,7 +155,10 @@ describe('MemberDetail', () => {

test('Title should be User Details for Super Admin', async () => {
setItem('SuperAdmin', true);
renderMemberDetail();

await act(async () => {
renderMemberDetail();
});

await waitFor(() => {
expect(screen.getByTestId('container')).toBeInTheDocument();
Expand All @@ -163,25 +168,39 @@ describe('MemberDetail', () => {
});

test('Should change tab', async () => {
renderMemberDetail();
await act(async () => {
renderMemberDetail();
});

await waitFor(() => {
expect(screen.getByTestId('container')).toBeInTheDocument();
});

const tab = screen.getByTestId('organizationsBtn');
tab.click();
await act(async () => {
const tab = screen.getByTestId('organizationsBtn');
tab.click();
});

expect(screen.getByTestId('memberorganizationTab')).toBeInTheDocument();
await waitFor(() => {
expect(screen.getByTestId('memberorganizationTab')).toBeInTheDocument();
});

const tab1 = screen.getByTestId('eventsBtn');
tab1.click();
await act(async () => {
const tab1 = screen.getByTestId('eventsBtn');
tab1.click();
});

expect(screen.getByTestId('eventsTab')).toBeInTheDocument();
await waitFor(() => {
expect(screen.getByTestId('eventsTab')).toBeInTheDocument();
});

const tab2 = screen.getByTestId('tagsBtn');
tab2.click();
await act(async () => {
const tab2 = screen.getByTestId('tagsBtn');
tab2.click();
});

expect(screen.getByTestId('tagsTab')).toBeInTheDocument();
await waitFor(() => {
expect(screen.getByTestId('tagsTab')).toBeInTheDocument();
});
});
});

0 comments on commit 9d7f9dd

Please sign in to comment.