title: How to resolve "Invariant Violation" error, related to redux store?
body: <p>I was trying to do DOM testing, to check whether a dialog box is opening on button click. Then I got this error</p>
  
  <blockquote>
    <p>Invariant Violation: Could not find "store" in either the context or props of >"Connect(Photos)". Either wrap the root component in a , or >explicitly pass "store" as a prop to "Connect(Photos)".</p>
  </blockquote>
  
  <p>I used jest and my component is connected to the redux store using </p>
  
  <blockquote>
    <p>export default connect(mapToProps)(Photos);</p>
  </blockquote>
  
  <p>AccessoriesPhotos.js</p>
  
  <pre><code>class Photos extends React.Component {
      constructor() {
          super();
          this.state = {
              open: false,
  
          }
          this.handleOpen = this.handleOpen.bind(this);
      }
      handleOpen = () =&gt; {
          this.setState({ open: true });
      };
  
      render (){
          return (....)
      }
  
      const mapToProps = (state) =&gt; {
          return {
            Search: state.Search,
            App: state.App
          }
        }
  
  
      export default connect(mapToProps)(Photos);
  }
  </code></pre>
  
  <p>AccessoriesPhotos.test.js</p>
  
  <pre><code>import React from 'react';
  import Enzyme, {shallow} from 'enzyme';
  import Adapter from 'enzyme-adapter-react-16';
  import { Photos } from '../../../Photos/Bike/AccessoriesPhotos';
  
  Enzyme.configure({adapter: new Adapter()});
  
  it('Dialog box opens after click', () =&gt; {
  
    const openDialogButton = shallow(&lt;Photos open="true" close="false" /&gt;);
  
    expect(openDialogButton.text()).toEqual('true');
  
    openDialogButton.find('input').simulate('change');
  
    expect(openDialogButton.text()).toEqual('false');
  });
  </code></pre>
  
  <p>This is what I got as the result. </p>
  
  <blockquote>
    <p>Invariant Violation: Could not find "store" in either the context or props of >"Connect(Photos)". Either wrap the root component in a , or >explicitly pass "store" as a prop to "Connect(Photos)".strong text</p>
  </blockquote>