我想测试我的 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 中。