title: Invariant Violation: Could not find "store" in either the context or props of "Connect(SportsDatabase)"
body: <p>Full code here: <a href="https://gist.github.com/js08/0ec3d70dfda76d7e9fb4" rel="noreferrer">https://gist.github.com/js08/0ec3d70dfda76d7e9fb4</a></p>
  
  <p>Hi,</p>
  
  <ul>
  <li>I have an application where it shows different templates for desktop and mobile on basis of build environment.</li>
  <li>I am successfully able to develop it where I need to hide the navigation menu for my mobile template.</li>
  <li>right now I am able to write one test case where it fetches all the values through the proptypes and renders correctly</li>
  <li>but not sure how to write the unit test cases when its mobile it should not render nav component.</li>
  <li>I tried but I am facing an error...can you tell me how to fix it.</li>
  <li>provding code below.</li>
  </ul>
  
  <h1>Test case</h1>
  
  <pre class="lang-js prettyprint-override"><code>import {expect} from 'chai';
  import React from 'react';
  import TestUtils from 'react-addons-test-utils';
  import {SportsTopPortion} from '../../../src/components/sports-top-portion/sports-top-portion.jsx';
  require('../../test-utils/dom');
  
  
  describe('"sports-top-portion" Unit Tests', function() {
      let shallowRenderer = TestUtils.createRenderer();
  
      let sportsContentContainerLayout ='mobile';
      let sportsContentContainerProfile = {'exists': 'hasSidebar'};
      let sportsContentContainerAuthExchange = {hasValidAccessToken: true};
      let sportsContentContainerHasValidAccessToken ='test'; 
  
      it('should render correctly', () =&gt; {
          shallowRenderer.render(&lt;SportsTopPortion sportsWholeFramework={sportsContentContainerLayout} sportsPlayers={sportsContentContainerProfile} sportsAuthentication={sportsContentContainerAuthExchange} sportsUpperBar={{activeSportsLink:'test'}} /&gt;);
          //shallowRenderer.render(&lt;SportsTopPortion sportsWholeFramework={sportsContentContainerLayout} sportsPlayers={sportsContentContainerProfile} hasValidAccessToken={sportsContentContainerHasValidAccessToken}  /&gt;);
  
          let renderedElement = shallowRenderer.getRenderOutput();
          console.log("renderedElement-------&gt;" + JSON.stringify(renderedElement));
  
          expect(renderedElement).to.exist;
      });
  
      it('should not render sportsNavigationComponent when sports.build is mobile', () =&gt; {
          let sportsNavigationComponent = TestUtils.renderIntoDocument(&lt;SportsTopPortion sportsWholeFramework={sportsContentContainerLayout} sportsPlayers={sportsContentContainerProfile} sportsAuthentication={sportsContentContainerAuthExchange} sportsUpperBar={{activeSportsLink:'test'}} /&gt;);
          console.log("sportsNavigationComponent-------&gt;" + JSON.stringify(sportsNavigationComponent));
  
          //let footnoteContainer = TestUtils.findRenderedDOMComponentWithClass(sportsNavigationComponent, 'linkPack--standard');
  
          //expect(footnoteContainer).to.exist;
      });
  
  });
  </code></pre>
  
  <h1>Code snippet where test case need to be written</h1>
  
  <pre class="lang-js prettyprint-override"><code>if (sports.build === 'mobile') {
      sportsNavigationComponent = &lt;div /&gt;;
      sportsSideMEnu = &lt;div /&gt;;
      searchComponent = &lt;div /&gt;;
      sportsPlayersWidget = &lt;div /&gt;;
  }
  </code></pre>
  
  <h1>Error</h1>
  
  <pre class="lang-js prettyprint-override"><code>1) "sports-top-portion" Unit Tests should not render sportsNavigationComponent when sports.build is mobile:
       Invariant Violation: Could not find "store" in either the context or props of "Connect(SportsDatabase)". Either wrap the root component in a &lt;Provider&gt;, or explicitly pass "store" as a prop to "Connect(SportsDatabase)".
        at Object.invariant [as default] (C:\sports-whole-page\node_modules\invariant\invariant.js:42:15)
        at new Connect (C:\sports-whole-page\node_modules\react-redux\lib\components\createConnect.js:135:33)
        at [object Object].ReactCompositeComponentMixin.mountComponent (C:\sports-whole-page\node_modules\react\lib\ReactCompositeComponent.js:148:18)
        at [object Object].wrapper [as mountComponent] (C:\sports-whole-page\node_modules\react\lib\ReactPerf.js:66:21)
        at Object.ReactReconciler.mountComponent (C:\sports-whole-page\node_modules\react\lib\ReactReconciler.js:37:35)
        at ReactDOMComponent.ReactMultiChild.Mixin.mountChildren (C:\sports-whole-page\node_modules\react\lib\ReactMultiChild.js:241:44)
        at ReactDOMComponent.Mixin._createContentMarkup (C:\sports-whole-page\node_modules\react\lib\ReactDOMComponent.js:591:32)
        at ReactDOMComponent.Mixin.mountComponent (C:\sports-whole-page\node_modules\react\lib\ReactDOMComponent.js:479:29)
        at Object.ReactReconciler.mountComponent (C:\sports-whole-page\node_modules\react\lib\ReactReconciler.js:37:35)
        at ReactDOMComponent.ReactMultiChild.Mixin.mountChildren (C:\sports-whole-page\node_modules\react\lib\ReactMultiChild.js:241:44)
        at ReactDOMComponent.Mixin._createContentMarkup (C:\sports-whole-page\node_modules\react\lib\ReactDOMComponent.js:591:32)
        at ReactDOMComponent.Mixin.mountComponent (C:\sports-whole-page\node_modules\react\lib\ReactDOMComponent.js:479:29)
        at Object.ReactReconciler.mountComponent (C:\sports-whole-page\node_modules\react\lib\ReactReconciler.js:37:35)
        at [object Object].ReactCompositeComponentMixin.mountComponent (C:\sports-whole-page\node_modules\react\lib\ReactCompositeComponent.js:225:34)
        at [object Object].wrapper [as mountComponent] (C:\sports-whole-page\node_modules\react\lib\ReactPerf.js:66:21)
        at Object.ReactReconciler.mountComponent (C:\sports-whole-page\node_modules\react\lib\ReactReconciler.js:37:35)
        at ReactDOMComponent.ReactMultiChild.Mixin.mountChildren (C:\sports-whole-page\node_modules\react\lib\ReactMultiChild.js:241:44)
        at ReactDOMComponent.Mixin._createContentMarkup (C:\sports-whole-page\node_modules\react\lib\ReactDOMComponent.js:591:32)
        at ReactDOMComponent.Mixin.mountComponent (C:\sports-whole-page\node_modules\react\lib\ReactDOMComponent.js:479:29)
        at Object.ReactReconciler.mountComponent (C:\sports-whole-page\node_modules\react\lib\ReactReconciler.js:37:35)
        at [object Object].ReactCompositeComponentMixin.mountComponent (C:\sports-whole-page\node_modules\react\lib\ReactCompositeComponent.js:225:34)
        at [object Object].wrapper [as mountComponent] (C:\sports-whole-page\node_modules\react\lib\ReactPerf.js:66:21)
        at Object.ReactReconciler.mountComponent (C:\sports-whole-page\node_modules\react\lib\ReactReconciler.js:37:35)
        at ReactDOMComponent.ReactMultiChild.Mixin.mountChildren (C:\sports-whole-page\node_modules\react\lib\ReactMultiChild.js:241:44)
        at ReactDOMComponent.Mixin._createContentMarkup (C:\sports-whole-page\node_modules\react\lib\ReactDOMComponent.js:591:32)
        at ReactDOMComponent.Mixin.mountComponent (C:\sports-whole-page\node_modules\react\lib\ReactDOMComponent.js:479:29)
        at Object.ReactReconciler.mountComponent (C:\sports-whole-page\node_modules\react\lib\ReactReconciler.js:37:35)
        at [object Object].ReactCompositeComponentMixin.mountComponent (C:\sports-whole-page\node_modules\react\lib\ReactCompositeComponent.js:225:34)
        at [object Object].wrapper [as mountComponent] (C:\sports-whole-page\node_modules\react\lib\ReactPerf.js:66:21)
        at Object.ReactReconciler.mountComponent (C:\sports-whole-page\node_modules\react\lib\ReactReconciler.js:37:35)
        at [object Object].ReactCompositeComponentMixin.mountComponent (C:\sports-whole-page\node_modules\react\lib\ReactCompositeComponent.js:225:34)
        at [object Object].wrapper [as mountComponent] (C:\sports-whole-page\node_modules\react\lib\ReactPerf.js:66:21)
        at Object.ReactReconciler.mountComponent (C:\sports-whole-page\node_modules\react\lib\ReactReconciler.js:37:35)
        at mountComponentIntoNode (C:\sports-whole-page\node_modules\react\lib\ReactMount.js:266:32)
        at ReactReconcileTransaction.Mixin.perform (C:\sports-whole-page\node_modules\react\lib\Transaction.js:136:20)
        at batchedMountComponentIntoNode (C:\sports-whole-page\node_modules\react\lib\ReactMount.js:282:15)
        at ReactDefaultBatchingStrategyTransaction.Mixin.perform (C:\sports-whole-page\node_modules\react\lib\Transaction.js:136:20)
        at Object.ReactDefaultBatchingStrategy.batchedUpdates (C:\sports-whole-page\node_modules\react\lib\ReactDefaultBatchingStrategy.js:62:19)
        at Object.batchedUpdates (C:\sports-whole-page\node_modules\react\lib\ReactUpdates.js:94:20)
        at Object.ReactMount._renderNewRootComponent (C:\sports-whole-page\node_modules\react\lib\ReactMount.js:476:18)
        at Object.wrapper [as _renderNewRootComponent] (C:\sports-whole-page\node_modules\react\lib\ReactPerf.js:66:21)
        at Object.ReactMount._renderSubtreeIntoContainer (C:\sports-whole-page\node_modules\react\lib\ReactMount.js:550:32)
        at Object.ReactMount.render (C:\sports-whole-page\node_modules\react\lib\ReactMount.js:570:23)
        at Object.wrapper [as render] (C:\sports-whole-page\node_modules\react\lib\ReactPerf.js:66:21)
        at Object.ReactTestUtils.renderIntoDocument (C:\sports-whole-page\node_modules\react\lib\ReactTestUtils.js:76:21)
        at Context.&lt;anonymous&gt; (C:/codebase/sports-whole-page/test/components/sports-top-portion/sports-top-portion-unit-tests.js:28:41)
        at callFn (C:\sports-whole-page\node_modules\mocha\lib\runnable.js:286:21)
        at Test.Runnable.run (C:\sports-whole-page\node_modules\mocha\lib\runnable.js:279:7)
        at Runner.runTest (C:\sports-whole-page\node_modules\mocha\lib\runner.js:421:10)
        at C:\sports-whole-page\node_modules\mocha\lib\runner.js:528:12
        at next (C:\sports-whole-page\node_modules\mocha\lib\runner.js:341:14)
        at C:\sports-whole-page\node_modules\mocha\lib\runner.js:351:7
        at next (C:\sports-whole-page\node_modules\mocha\lib\runner.js:283:14)
        at Immediate._onImmediate (C:\sports-whole-page\node_modules\mocha\lib\runner.js:319:5)
  </code></pre>