Using Jest to mock a React component with props

前端 未结 3 1531
清歌不尽
清歌不尽 2020-12-29 04:45

I have a React component which contains some other components that depend on access to a Redux store etc., which cause issues when doing a full Enzyme mount. Let\'s say a st

3条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-29 05:27

    In my case, I was unable to make the mock work.

    An it turned out to be case-sensitivity issue:

    Module Filename: Autosuggest.js

    How i was mocking it: jest.mock('./AutoSuggest', ...); <-- wrong cases

提交回复
热议问题