Newer
Older
import React from 'react'
import { shallow } from 'enzyme'
import ChallengeCardDone from 'components/Challenge/ChallengeCardDone'
import { userChallengeData } from '../../../tests/__mocks__/userChallengeData.mock'
jest.mock('cozy-ui/transpiled/react/I18n', () => {
return {
useI18n: jest.fn(() => {
return {
t: (str: string) => str,
}
}),
}
})

Hugo SUBTIL
committed
const mockImportIconbyId = jest.fn()
const mockFormatNumberValues = jest.fn()
jest.mock('utils/utils', () => {
return {
importIconbyId: jest.fn(() => mockImportIconbyId),
formatNumberValues: jest.fn(() => mockFormatNumberValues),
getChallengeTitleWithLineReturn: jest.fn(() => 'Challenge 1'),

Hugo SUBTIL
committed
}
})
describe('ChallengeCardDone component', () => {
it('should be rendered correctly', () => {
const component = shallow(
<ChallengeCardDone userChallenge={userChallengeData[0]} />
).getElement()
expect(component).toMatchSnapshot()
})
})