Skip to content
Snippets Groups Projects
Commit 79ea883a authored by Bastien DUMONT's avatar Bastien DUMONT :angel:
Browse files

chore: remove eslint disable display name

parent 2b319e21
No related branches found
No related tags found
1 merge request!10622.7 Release
/* eslint-disable react/display-name */
import EcogestureCard from 'components/Ecogesture/EcogestureCard/EcogestureCard' import EcogestureCard from 'components/Ecogesture/EcogestureCard/EcogestureCard'
import { mount } from 'enzyme' import { mount } from 'enzyme'
import toJson from 'enzyme-to-json' import toJson from 'enzyme-to-json'
......
/* eslint-disable react/display-name */
import { Button } from '@material-ui/core' import { Button } from '@material-ui/core'
import { mount } from 'enzyme' import { mount } from 'enzyme'
import toJson from 'enzyme-to-json' import toJson from 'enzyme-to-json'
......
/* eslint-disable react/display-name */
import { mount } from 'enzyme' import { mount } from 'enzyme'
import toJson from 'enzyme-to-json' import toJson from 'enzyme-to-json'
import React from 'react' import React from 'react'
......
/* eslint-disable react/display-name */
import { Button } from '@material-ui/core' import { Button } from '@material-ui/core'
import { mount } from 'enzyme' import { mount } from 'enzyme'
import toJson from 'enzyme-to-json' import toJson from 'enzyme-to-json'
......
/* eslint-disable react/display-name */
import { EquipmentType } from 'enums' import { EquipmentType } from 'enums'
import { mount } from 'enzyme' import { mount } from 'enzyme'
import toJson from 'enzyme-to-json' import toJson from 'enzyme-to-json'
......
/* eslint-disable react/display-name */
import { mount } from 'enzyme' import { mount } from 'enzyme'
import toJson from 'enzyme-to-json' import toJson from 'enzyme-to-json'
import React from 'react' import React from 'react'
......
/* eslint-disable react/display-name */
import { UserQuestionState } from 'enums' import { UserQuestionState } from 'enums'
import { mount } from 'enzyme' import { mount } from 'enzyme'
import React from 'react' import React from 'react'
import { Provider } from 'react-redux' import { Provider } from 'react-redux'
import { createMockEcolyoStore } from 'tests/__mocks__/store' import { createMockEcolyoStore } from 'tests/__mocks__/store'
import { waitForComponentToPaint } from 'tests/__mocks__/testUtils'
import { userChallengeData } from 'tests/__mocks__/userChallengeData.mock' import { userChallengeData } from 'tests/__mocks__/userChallengeData.mock'
import QuizQuestion from './QuizQuestion' import QuizQuestion from './QuizQuestion'
const mockgetCustomQuestion = jest.fn() const mockGetCustomQuestion = jest.fn()
jest.mock('services/quiz.service', () => { jest.mock('services/quiz.service', () => {
return jest.fn(() => { return jest.fn(() => {
return { return {
getCustomQuestion: mockgetCustomQuestion, getCustomQuestion: mockGetCustomQuestion,
} }
}) })
}) })
jest.mock( jest.mock(
'components/Quiz/QuizQuestion/QuizQuestionContentCustom', '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', () => { describe('QuizQuestion component', () => {
const store = createMockEcolyoStore() const store = createMockEcolyoStore()
...@@ -30,17 +31,18 @@ describe('QuizQuestion component', () => { ...@@ -30,17 +31,18 @@ describe('QuizQuestion component', () => {
store.clearActions() store.clearActions()
}) })
it('should be rendered correctly with question', () => { it('should be rendered correctly with question', async () => {
const wrapper = mount( const wrapper = mount(
<Provider store={store}> <Provider store={store}>
<QuizQuestion userChallenge={userChallengeData[0]} /> <QuizQuestion userChallenge={userChallengeData[0]} />
</Provider> </Provider>
) )
expect(wrapper.find('#quizquestioncontent').exists()).toBeTruthy() await waitForComponentToPaint(wrapper)
expect(wrapper.find('#QuizQuestionContentCustom').exists()).toBeFalsy() 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 = { const updateUserChallengeData = {
...userChallengeData[0], ...userChallengeData[0],
} }
...@@ -52,7 +54,8 @@ describe('QuizQuestion component', () => { ...@@ -52,7 +54,8 @@ describe('QuizQuestion component', () => {
<QuizQuestion userChallenge={updateUserChallengeData} /> <QuizQuestion userChallenge={updateUserChallengeData} />
</Provider> </Provider>
) )
expect(wrapper.find('#quizquestioncontent').exists()).toBeFalsy() await waitForComponentToPaint(wrapper)
expect(wrapper.find('#QuizQuestionContentCustom').exists()).toBeTruthy() expect(wrapper.find('mock-question').exists()).toBeFalsy()
expect(wrapper.find('mock-customQuestion').exists()).toBeTruthy()
}) })
}) })
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment