title: How do I unit test child functions with jest and enzyme?
body: <p>I have a component that looks like this:</p>
  
  <pre><code>const TestComponent = ({ mobile }) =&gt; (
    &lt;&gt;
      &lt;div&gt;
        Your estimate
        {!mobile &amp;&amp; (
          &lt;InfoButton&gt;
            {target =&gt; (
              &lt;Tooltip
                target={target}
              &gt;
                My tooltip text
              &lt;/Tooltip&gt;
            )}
          &lt;/InfoButton&gt;
        )}
      &lt;/div&gt;
    &lt;/&gt;
  );
  </code></pre>
  
  <p>I'm trying to add a unit test for this using jest and enzyme and run into an issue when I try to look for <code>Tooltip</code> being rendered. I believe this is because it's rendered by a function so when I debug in jest this is what I see</p>
  
  <pre><code>  &lt;InfoButton className="infoButton"&gt;
      [function]
    &lt;/InfoButton&gt;
  </code></pre>
  
  <p>And I can't <code>.find()</code>or <code>.dive()</code> further into to actually look for the <code>Tooltip</code> component. How do I get that function to actually render content when testing with jest? </p>
  
  <p>UPDATE: Adding my test</p>
  
  <pre><code>it("should render info button with tooltip", () =&gt; {
    const wrapper = renderSubject(); // My render fn which randers the parent compoennt
    const testComponent = wrapper
      .find("TestComponent")
      .first()
      .dive();
    expect(testComponent.find("InfoButton").exists()).toBe(true);
    console.log(testComponent.find("InfoButton").debug());
  });
  </code></pre>