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

685 views Asked by At

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.

1

There are 1 answers

0
Tanuj Gupta On BEST ANSWER

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'