我如何使用酶和笑话来测试这个?

时间:2021-05-01 03:28:47

标签: reactjs react-redux enzyme

我想测试我的 Header 组件,这是我的测试文件。

import React from "react";
import { Provider } from "react-redux";
import { shallow, mount } from "enzyme";
import Header from "./index";
    
describe("Header Component", () => {
  it("should render without errors", () => {
    const component = shallow(<Header />);
  });
});

我有这个错误:

could not find react-redux context value; please ensure the component is wrapped in a <Provider>

我在 index.js 中的应用被包装在 redux provider store 中。

0 个答案:

没有答案