TypeError:无法读取浅的未定义问题的属性“ contextTypes”

时间:2019-12-23 09:28:11

标签: reactjs jestjs

从酶中浅导入的问题,未定义contextTypes。

import React from 'react';
import { shallow } from  'enzyme'
import { configure, shallow } from 'enzyme';
import Adapter from 'enzyme-adapter-react-15';
import {SignIn} from '../containers/authentication/SignIn';

configure({ adapter: new Adapter() });

describe('SignIn', () => {
  it('render sign in', () => {
      const props = {
          email: "qqq@gmail.com",
          password: "pass123",
          errors:() => {},
          loading:() => {}
      };

      // const store = mockStore(state);
      const dwrapper = shallow(<SignIn {...props} />);
      console.log(dwrapper);
      expect(dwrapper.props().email).toBe("qqq@gmail.com")  
  });

});

这里浅表是什么问题?为什么无法读取contextType

登录,渲染登录

TypeError:无法读取未定义的属性'contextTypes'

39 | // const store = mockStore(state);

  

40 | const dwrapper = depth();

0 个答案:

没有答案