Search code examples
reactjsreduxantdredux-sagaumijs

UmiJs Unit test error - _umi.connect) is not a function


I am new in unit testing in reactjs. I tried to test my login component rendering For testing, i am using JEST and enzyme.

[This is the error, i am getting]

Test case code:

import React from 'react';
import { shallow } from 'enzyme';
import Login from './index'; // Introduce the corresponding React component

it('renders Login page', () => {
    const wrapper = shallow(<Login.WrappedComponent login={{ name: '' }} />);
})

i am using Real project with umi - https://ant.design/docs/react/practical-projects

can any one help me on this.


Solution

  • We can use connect from react-redux instead of umi. actually umi is also using react-redux inside of it.

    Replace this line in your component :

    import { connect } from 'umi' with import { connect } from 'react-redux'