From 9d7f9dd3b35ca8c54ad59498444e6a89a662d9b7 Mon Sep 17 00:00:00 2001 From: Doraemon012 Date: Sun, 29 Sep 2024 12:05:01 +0530 Subject: [PATCH] fixed failing tests --- public/locales/fr/translation.json | 6 ++- public/locales/hi/translation.json | 6 ++- public/locales/sp/translation.json | 8 ++-- public/locales/zh/translation.json | 6 +-- .../MemberDetail/MemberDetail.test.tsx | 43 +++++++++++++------ 5 files changed, 45 insertions(+), 24 deletions(-) diff --git a/public/locales/fr/translation.json b/public/locales/fr/translation.json index a5b264679a..447e2ff958 100644 --- a/public/locales/fr/translation.json +++ b/public/locales/fr/translation.json @@ -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", @@ -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", diff --git a/public/locales/hi/translation.json b/public/locales/hi/translation.json index 5b6ccc21e2..656f3a9755 100644 --- a/public/locales/hi/translation.json +++ b/public/locales/hi/translation.json @@ -280,7 +280,8 @@ "talawaApiUnavailable": "तालावा एपीआई अनुपलब्ध" }, "organizationPeople": { - "title": "तालावा सदस्य", + "title": "सदस्य", + "title_superadmin": "उपयोगकर्ता", "filterByName": "नाम से फ़िल्टर करें", "filterByLocation": "स्थान से फ़िल्टर करें", "filterByEvent": "घटना से फ़िल्टर करें", @@ -878,7 +879,8 @@ "organizations": "संगठन", "events": "घटनाएँ", "tags": "टैग", - "title": "उपयोगकर्ता विवरण" + "title_superadmin": "उपयोगकर्ता विवरण", + "title": "सदस्य विवरण" }, "orgMemberDetail": { "title": "उपयोगकर्ता विवरण", diff --git a/public/locales/sp/translation.json b/public/locales/sp/translation.json index 66024e8d2c..f39958b5b2 100644 --- a/public/locales/sp/translation.json +++ b/public/locales/sp/translation.json @@ -623,7 +623,6 @@ "raisedAmount": "Monto recaudado", "pledgedAmount": "Monto comprometido" }, - "orgPost": { "title": "Publicaciones de Talawa", "searchPost": "Buscar Publicación", @@ -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", diff --git a/public/locales/zh/translation.json b/public/locales/zh/translation.json index 6740cb3025..c294a651be 100644 --- a/public/locales/zh/translation.json +++ b/public/locales/zh/translation.json @@ -281,6 +281,7 @@ }, "organizationPeople": { "title": "塔拉瓦会员", + "title_superadmin": "塔拉瓦用户", "filterByName": "按名称过滤", "filterByLocation": "按地点过滤", "filterByEvent": "按事件过滤", @@ -878,9 +879,9 @@ "organizations": "组织", "events": "活动", "tags": "标签", - "title": "用户详情" + "title_superadmin": "用户详情", + "title": "成员详情" }, - "orgMemberDetail": { "title": "用户详情", "addAdmin": "添加管理员", @@ -923,7 +924,6 @@ "joined": "已加入", "talawaApiUnavailable": "塔拉瓦 API 不可用" }, - "memberOrganization": { "sort": "按角色搜索", "noOrgError": "未找到组织,请通过仪表板创建组织", diff --git a/src/screens/MemberDetail/MemberDetail.test.tsx b/src/screens/MemberDetail/MemberDetail.test.tsx index b0866eabd7..592d9634f3 100644 --- a/src/screens/MemberDetail/MemberDetail.test.tsx +++ b/src/screens/MemberDetail/MemberDetail.test.tsx @@ -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(); @@ -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(); @@ -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(); + }); }); });