From 79ea883a89d27dfe9f81a58671307394d0fbb113 Mon Sep 17 00:00:00 2001
From: Bastien Dumont <bdumont@grandlyon.com>
Date: Thu, 9 Nov 2023 16:45:20 +0100
Subject: [PATCH] chore: remove eslint disable display name

---
 .../EcogestureCard/EcogestureCard.spec.tsx    |  1 -
 .../EcogestureNotFound.spec.tsx               |  1 -
 .../Ecogesture/SingleEcogestureView.spec.tsx  |  1 -
 .../EcogestureFormView.spec.tsx               |  1 -
 .../EquipmentIcon/EquipmentIcon.spec.tsx      |  1 -
 .../EcogestureSelectionView.spec.tsx          |  1 -
 .../Quiz/QuizQuestion/QuizQuestion.spec.tsx   | 29 ++++++++++---------
 7 files changed, 16 insertions(+), 19 deletions(-)

diff --git a/src/components/Ecogesture/EcogestureCard/EcogestureCard.spec.tsx b/src/components/Ecogesture/EcogestureCard/EcogestureCard.spec.tsx
index 836668c81..d00c057dc 100644
--- a/src/components/Ecogesture/EcogestureCard/EcogestureCard.spec.tsx
+++ b/src/components/Ecogesture/EcogestureCard/EcogestureCard.spec.tsx
@@ -1,4 +1,3 @@
-/* eslint-disable react/display-name */
 import EcogestureCard from 'components/Ecogesture/EcogestureCard/EcogestureCard'
 import { mount } from 'enzyme'
 import toJson from 'enzyme-to-json'
diff --git a/src/components/Ecogesture/EcogestureNotFound/EcogestureNotFound.spec.tsx b/src/components/Ecogesture/EcogestureNotFound/EcogestureNotFound.spec.tsx
index 9be727a77..2fda3b550 100644
--- a/src/components/Ecogesture/EcogestureNotFound/EcogestureNotFound.spec.tsx
+++ b/src/components/Ecogesture/EcogestureNotFound/EcogestureNotFound.spec.tsx
@@ -1,4 +1,3 @@
-/* eslint-disable react/display-name */
 import { Button } from '@material-ui/core'
 import { mount } from 'enzyme'
 import toJson from 'enzyme-to-json'
diff --git a/src/components/Ecogesture/SingleEcogestureView.spec.tsx b/src/components/Ecogesture/SingleEcogestureView.spec.tsx
index 4d889d7d5..6f96223ab 100644
--- a/src/components/Ecogesture/SingleEcogestureView.spec.tsx
+++ b/src/components/Ecogesture/SingleEcogestureView.spec.tsx
@@ -1,4 +1,3 @@
-/* eslint-disable react/display-name */
 import { mount } from 'enzyme'
 import toJson from 'enzyme-to-json'
 import React from 'react'
diff --git a/src/components/EcogestureForm/EcogestureFormView.spec.tsx b/src/components/EcogestureForm/EcogestureFormView.spec.tsx
index 77256f6dc..35e92dd4a 100644
--- a/src/components/EcogestureForm/EcogestureFormView.spec.tsx
+++ b/src/components/EcogestureForm/EcogestureFormView.spec.tsx
@@ -1,4 +1,3 @@
-/* eslint-disable react/display-name */
 import { Button } from '@material-ui/core'
 import { mount } from 'enzyme'
 import toJson from 'enzyme-to-json'
diff --git a/src/components/EcogestureForm/EquipmentIcon/EquipmentIcon.spec.tsx b/src/components/EcogestureForm/EquipmentIcon/EquipmentIcon.spec.tsx
index 6d248173c..7fe4d6d3d 100644
--- a/src/components/EcogestureForm/EquipmentIcon/EquipmentIcon.spec.tsx
+++ b/src/components/EcogestureForm/EquipmentIcon/EquipmentIcon.spec.tsx
@@ -1,4 +1,3 @@
-/* eslint-disable react/display-name */
 import { EquipmentType } from 'enums'
 import { mount } from 'enzyme'
 import toJson from 'enzyme-to-json'
diff --git a/src/components/EcogestureSelection/EcogestureSelectionView.spec.tsx b/src/components/EcogestureSelection/EcogestureSelectionView.spec.tsx
index 234ba798c..ad65360fb 100644
--- a/src/components/EcogestureSelection/EcogestureSelectionView.spec.tsx
+++ b/src/components/EcogestureSelection/EcogestureSelectionView.spec.tsx
@@ -1,4 +1,3 @@
-/* eslint-disable react/display-name */
 import { mount } from 'enzyme'
 import toJson from 'enzyme-to-json'
 import React from 'react'
diff --git a/src/components/Quiz/QuizQuestion/QuizQuestion.spec.tsx b/src/components/Quiz/QuizQuestion/QuizQuestion.spec.tsx
index 1421e6ce3..bd99fbd4c 100644
--- a/src/components/Quiz/QuizQuestion/QuizQuestion.spec.tsx
+++ b/src/components/Quiz/QuizQuestion/QuizQuestion.spec.tsx
@@ -1,28 +1,29 @@
-/* eslint-disable react/display-name */
 import { UserQuestionState } from 'enums'
 import { mount } from 'enzyme'
 import React from 'react'
 import { Provider } from 'react-redux'
 import { createMockEcolyoStore } from 'tests/__mocks__/store'
+import { waitForComponentToPaint } from 'tests/__mocks__/testUtils'
 import { userChallengeData } from 'tests/__mocks__/userChallengeData.mock'
 import QuizQuestion from './QuizQuestion'
 
-const mockgetCustomQuestion = jest.fn()
+const mockGetCustomQuestion = jest.fn()
 jest.mock('services/quiz.service', () => {
   return jest.fn(() => {
     return {
-      getCustomQuestion: mockgetCustomQuestion,
+      getCustomQuestion: mockGetCustomQuestion,
     }
   })
 })
 
 jest.mock(
   'components/Quiz/QuizQuestion/QuizQuestionContentCustom',
-  () => () => <div id="QuizQuestionContentCustom" />
+  () => 'mock-customQuestion'
+)
+jest.mock(
+  'components/Quiz/QuizQuestion/QuizQuestionContent',
+  () => 'mock-question'
 )
-jest.mock('components/Quiz/QuizQuestion/QuizQuestionContent', () => () => (
-  <div id="quizquestioncontent" />
-))
 
 describe('QuizQuestion component', () => {
   const store = createMockEcolyoStore()
@@ -30,17 +31,18 @@ describe('QuizQuestion component', () => {
     store.clearActions()
   })
 
-  it('should be rendered correctly with question', () => {
+  it('should be rendered correctly with question', async () => {
     const wrapper = mount(
       <Provider store={store}>
         <QuizQuestion userChallenge={userChallengeData[0]} />
       </Provider>
     )
-    expect(wrapper.find('#quizquestioncontent').exists()).toBeTruthy()
-    expect(wrapper.find('#QuizQuestionContentCustom').exists()).toBeFalsy()
+    await waitForComponentToPaint(wrapper)
+    expect(wrapper.find('mock-question').exists()).toBeTruthy()
+    expect(wrapper.find('mock-customQuestion').exists()).toBeFalsy()
   })
 
-  it('should be rendered correctly with customQuestion', () => {
+  it('should be rendered correctly with customQuestion', async () => {
     const updateUserChallengeData = {
       ...userChallengeData[0],
     }
@@ -52,7 +54,8 @@ describe('QuizQuestion component', () => {
         <QuizQuestion userChallenge={updateUserChallengeData} />
       </Provider>
     )
-    expect(wrapper.find('#quizquestioncontent').exists()).toBeFalsy()
-    expect(wrapper.find('#QuizQuestionContentCustom').exists()).toBeTruthy()
+    await waitForComponentToPaint(wrapper)
+    expect(wrapper.find('mock-question').exists()).toBeFalsy()
+    expect(wrapper.find('mock-customQuestion').exists()).toBeTruthy()
   })
 })
-- 
GitLab