首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用jest时,TypeError:(0,_umi.connect)不是函数

使用jest时,TypeError:(0,_umi.connect)不是函数
EN

Stack Overflow用户
提问于 2020-08-26 20:03:49
回答 1查看 815关注 0票数 0

我正在使用jest和酶进行单元测试。但我没有使用react- redux,而是使用umi进行集中的状态管理,但在幕后它只使用redux。现在,当我运行测试文件时,我得到了这个错误

TypeError:(0,_umi.connect)不是函数

代码语言:javascript
复制
  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)

这是我的测试文件

代码语言:javascript
复制
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: '' }} />,
  );
})
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2020-08-27 15:48:55

我发现有一个已经打开的github问题。问题基本上出在umi库上。我使用了react-redux的connect方法,它工作得很好,但同时,仅仅使用connect方法并不适合多一个库。我一直在使用它,直到它在umi中被修复。

https://github.com/umijs/umi/issues/5138https://github.com/ant-design/ant-design-pro/issues/6401

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/63597240

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档