title: Jest/Enzyme is there a matcher for a component?
body: <p>I have a React component method that returns and other component. Is there a Jest matcher to test this?</p>
  
  <p>For example, my component has the following method:</p>
  
  <pre><code>class App extends React.Component {
  
    selectDashboardView(dashboard) {
      if (!dashboard) {
        return null;
      }
  
      switch (dashboard) {
        case DASHBOARD_TYPE.advisor:
          return &lt;AdvisorDashboard /&gt;;
  
        case DASHBOARD_TYPE.advisor_fund:
          return &lt;AdvisorFundDashboard /&gt;;
  
        case DASHBOARD_TYPE.portfolio:
          return &lt;PortfolioDashboard /&gt;;
  
        case DASHBOARD_TYPE.investor_profile:
          return &lt;InvestorProfileDashboard /&gt;;
  
        case DASHBOARD_TYPE.investment:
          return &lt;InvestmentDashboard /&gt;;
  
        default:
          return null;
      }
    }
    ...
  }
  </code></pre>
  
  <p>I would like to be able to write a test like this (obviously, this is not a valid test):</p>
  
  <pre><code>describe('App', () =&gt; {
    test('selects proper dashboard', () =&gt; {
      const wrapper = shallow(&lt;App /&gt;);
      const instance = wrapper.instance();
  
      expect(instance.selectDashboardView('advisor')).toMatch(&lt;AdvisorDashboard /&gt;);
  
    });
  });
  </code></pre>
  
  <p><strong>Update:</strong>
  It may be important to note that these components are connected to Redux. When testing <code>&lt;App /&gt;</code>, I imported the unconnected component, the same with <code>&lt;AdvisorDashboard /&gt;</code>, etc... I was able to solve the problem with the following code:</p>
  
  <pre><code>describe('App', () =&gt; {
    test('selects proper dashboard', () =&gt; {
      const wrapper = shallow(&lt;App setDashboard={mockFn} setIsAdvisor={mockFn} /&gt;);
      const instance = wrapper.instance();
  
      expect(instance.selectDashboardView('advisor').type.WrappedComponent).toEqual(AdvisorDashboard);
      expect(instance.selectDashboardView('investor_profile').type.WrappedComponent).toEqual(InvestorProfileDashboard);
  
    });
  });
  </code></pre>