reduxjs / react-redux

Official React bindings for Redux
https://react-redux.js.org
MIT License
23.37k stars 3.37k forks source link

typescriptError: (0 , _reactRedux.connect) is not a function #1624

Closed karanbht507 closed 4 years ago

karanbht507 commented 4 years ago

Hi I am using jest and enzyme for unit testing and in this when I run test cases getting this error in login container. Login container is connected with connect.

Here is the complete error- TypeError: (0 , _reactRedux.connect) is not a function

  101 | };
  102 | 
> 103 | export default connect(({ login, loading }: ConnectState) => ({
      |                ^
  104 |   userLogin: login,
  105 |   submitting: loading.effects['login/login'],
  106 | }))(Login);

  at Object.<anonymous> (src/pages/user/login/index.tsx:103:16)
  at Object.<anonymous> (src/pages/user/login/login.test.js:6:1)

And here is the test file

import { shallow, configure } from 'enzyme'; import Adapter from 'enzyme-adapter-react-16'; configure({ adapter: new Adapter() });

describe('Login component tests', () => { let wrapper = shallow( <LoginContainer.WrappedComponent userLogin={{ status: '', message: '' }} />, ); })

Thanks for help in advance

timdorr commented 4 years ago

The issue tracker here on GitHub is reserved for bug reports and feature requests. For usage questions (which is what I believe this is), please use Stack Overflow or Reactiflux where there are a lot more people ready to help you out. Thanks!

Please feel free to reply if you think this issue was closed prematurely.