Invariant Violation: Could not find “store” in either the context or props of “Connect(SportsDatabase)”

后端 未结 9 1766
别那么骄傲
别那么骄傲 2020-12-12 10:36

Full code here: https://gist.github.com/js08/0ec3d70dfda76d7e9fb4

Hi,

  • I have an application where it shows different templates for desktop and mobile
9条回答
  •  一个人的身影
    2020-12-12 10:59

    Possible solution that worked for me with jest

    import React from "react";
    import { shallow } from "enzyme";
    import { Provider } from "react-redux";
    import configureMockStore from "redux-mock-store";
    import TestPage from "../TestPage";
    
    const mockStore = configureMockStore();
    const store = mockStore({});
    
    describe("Testpage Component", () => {
        it("should render without throwing an error", () => {
            expect(
                shallow(
                    
                        
                    
                ).exists(

    Test page

    ) ).toBe(true); }); });

提交回复
热议问题