Skip to content
Snippets Groups Projects
Commit 45bafd80 authored by Yoan VALLET's avatar Yoan VALLET
Browse files

feat: update tests

parent 724583b1
No related branches found
No related tags found
1 merge request!318Features/accessibility forms
...@@ -5,8 +5,8 @@ import configureStore from 'redux-mock-store' ...@@ -5,8 +5,8 @@ import configureStore from 'redux-mock-store'
import { profileData } from '../../../test/__mocks__/profile.mock' import { profileData } from '../../../test/__mocks__/profile.mock'
import { globalStateData } from '../../../test/__mocks__/globalStateData.mock' import { globalStateData } from '../../../test/__mocks__/globalStateData.mock'
import { Provider } from 'react-redux' import { Provider } from 'react-redux'
import MuiButton from '@material-ui/core/Button' import Dialog from '@material-ui/core/Dialog'
import Modal from 'components/CommonKit/Modal/Modal' import Button from '@material-ui/core/Button'
jest.mock('cozy-ui/transpiled/react/I18n', () => { jest.mock('cozy-ui/transpiled/react/I18n', () => {
return { return {
...@@ -41,8 +41,8 @@ describe('AnalysisErrorModal component', () => { ...@@ -41,8 +41,8 @@ describe('AnalysisErrorModal component', () => {
<AnalysisErrorModal /> <AnalysisErrorModal />
</Provider> </Provider>
) )
expect(wrapper.find(Modal).exists()).toBeTruthy() expect(wrapper.find(Dialog).exists()).toBeTruthy()
expect(wrapper.find(MuiButton).exists()).toBeTruthy() expect(wrapper.find(Button).exists()).toBeTruthy()
}) })
it('should redirect to previous page', () => { it('should redirect to previous page', () => {
const store = mockStore({ const store = mockStore({
......
...@@ -45,7 +45,8 @@ describe('ChallengeCardUnlocked component', () => { ...@@ -45,7 +45,8 @@ describe('ChallengeCardUnlocked component', () => {
userChallengeData[0].title userChallengeData[0].title
) )
expect(wrapper.find('.btn-duel-active').exists()).toBeTruthy() expect(wrapper.find('.btn-duel-active').exists()).toBeTruthy()
expect(wrapper.find(ChallengeNoFluidModal).exists()).toBeFalsy() expect(wrapper.find(ChallengeNoFluidModal).exists()).toBeTruthy()
expect(wrapper.find(ChallengeNoFluidModal).prop('open')).toBeFalsy()
}) })
it('should display ChallengeNoFluidModal when launching challenge without configured fluid', () => { it('should display ChallengeNoFluidModal when launching challenge without configured fluid', () => {
...@@ -64,6 +65,7 @@ describe('ChallengeCardUnlocked component', () => { ...@@ -64,6 +65,7 @@ describe('ChallengeCardUnlocked component', () => {
.first() .first()
.simulate('click') .simulate('click')
expect(wrapper.find(ChallengeNoFluidModal).exists()).toBeTruthy() expect(wrapper.find(ChallengeNoFluidModal).exists()).toBeTruthy()
expect(wrapper.find(ChallengeNoFluidModal).prop('open')).toBeTruthy()
}) })
it('should not display ChallengeNoFluidModal and update userChallenge when launching challenge with configured fluid', () => { it('should not display ChallengeNoFluidModal and update userChallenge when launching challenge with configured fluid', () => {
...@@ -85,7 +87,8 @@ describe('ChallengeCardUnlocked component', () => { ...@@ -85,7 +87,8 @@ describe('ChallengeCardUnlocked component', () => {
.find('.btn-duel-active') .find('.btn-duel-active')
.first() .first()
.simulate('click') .simulate('click')
expect(wrapper.find(ChallengeNoFluidModal).exists()).toBeFalsy() expect(wrapper.find(ChallengeNoFluidModal).exists()).toBeTruthy()
expect(wrapper.find(ChallengeNoFluidModal).prop('open')).toBeFalsy()
expect(mockStartUserChallenge).toHaveBeenCalledWith(userChallengeData[0]) expect(mockStartUserChallenge).toHaveBeenCalledWith(userChallengeData[0])
}) })
}) })
...@@ -4,8 +4,6 @@ import { shallow } from 'enzyme' ...@@ -4,8 +4,6 @@ import { shallow } from 'enzyme'
import FeedbackModal from 'components/Feedback/FeedbackModal' import FeedbackModal from 'components/Feedback/FeedbackModal'
import MuiButton from '@material-ui/core/Button' import MuiButton from '@material-ui/core/Button'
import Modal from 'components/CommonKit/Modal/Modal'
import StyledIconButton from 'components/CommonKit/IconButton/StyledIconButton'
import { userChallengeExplo1OnGoing } from '../../../test/__mocks__/userChallengeData.mock' import { userChallengeExplo1OnGoing } from '../../../test/__mocks__/userChallengeData.mock'
const mockSendMail = jest.fn() const mockSendMail = jest.fn()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment