Skip to content
Snippets Groups Projects
ChallengeCardDone.spec.tsx 980 B
Newer Older
  • Learn to ignore specific revisions
  • Yoan VALLET's avatar
    Yoan VALLET committed
    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,
          }
        }),
      }
    })
    
    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'),
    
    Yoan VALLET's avatar
    Yoan VALLET committed
    
    describe('ChallengeCardDone component', () => {
      it('should be rendered correctly', () => {
        const component = shallow(
          <ChallengeCardDone userChallenge={userChallengeData[0]} />
        ).getElement()
        expect(component).toMatchSnapshot()
      })
    })