score:7

Accepted answer

I found the solution, it was just put the mock outside the describe.

import React from 'react'
import renderer from 'react-test-renderer'
import { DatePicker } from './DatePicker'

jest.mock('react-text-mask', () => props => <input type="text" {...{ ...props }} />)

describe('<DatePicker />', () => {
  it('should have default props', () => {
    const tree = renderer.create(<DatePicker onChange={Function} />).toJSON()

    expect(tree).toMatchSnapshot()
  })
})

Related Query

More Query from same tag