首页 > 解决方案 > TypeError: value.includes 不是使用挂载测试的函数

问题描述

我正在尝试使用mount

import React from 'react';
import { mount } from 'enzyme'

import { Provider } from 'react-redux';
import configureStore from 'redux-mock-store';
import thunk from 'redux-thunk';

describe('component', ()=>{
       const middlewares = [thunk];

        const mockStore = configureStore(middlewares);
        const store = mockStore({data: [] });
        const wrapper = mount(
          <Provider store={store}>
            <Component onClick={jest.fn()} shouldFetch={true} />
          </Provider>
        );`enter code here`

        it('THEN should', ()=>{
         })

})

但是当我执行测试时出现错误:

TypeError: value.includes is not a function

但是当我尝试shallow一切都很好时

标签: javascriptunit-testingtestingjestjsredux-mock-store

解决方案


推荐阅读