title: How to test lambda functions in a functional React Component using Jest/Enzyme?
body: <p>I am attempting to create a pulldown tab, however I haven't gotten anywhere close to adding any functionality because I'm attempting to do this TDD style and I've been incapable of even testing if the function inside of the component triggers on the click event of the button. The jest logs tell me that the object I'm attempting to reference is not a function.</p>
  
  <p>I've attempted to create an instance of the component I'm testing and provide that as an argument to "expect" function using the "toBeCalled" function as a matcher this did not work. </p>
  
  <p>The component itself: </p>
  
  <pre><code>import React from "react";
  import headerImg from "./headerImg.png";
  
  function PullDown() {
    const displayUPC = () =&gt; {};
  
    return &lt;button onClick={displayUPC} /&gt;;
  }
  export default PullDown;
  </code></pre>
  
  <p>The tests for the Component:</p>
  
  <pre><code>import React from "react";
  import ReactDOM from "react-dom";
  import { shallow, mount, configure, instance } from "enzyme";
  import Adapter from "enzyme-adapter-react-16";
  import PullDown from "./PullDown";
  import enzyme from "enzyme";
  
  configure({ adapter: new Adapter() });
  
  describe("Pulldown tab", () =&gt; {
    let wrapperPulldown;
    beforeEach(() =&gt; {
      wrapperPulldown = shallow(&lt;PullDown /&gt;);
    });
  
    it("should render", () =&gt; {
      expect(wrapperPulldown.find("button")).toHaveLength(1);
    });
  
    it("should be clickable", () =&gt; {
      wrapperPulldown.find("button").simulate("click");
      expect(wrapperPulldown.displayUPC()).toBeCalled();
    });
  });
  </code></pre>
  
  <p>I expect the test to fail, and it does, however when I go and add the function to the component and add the onClick with the function attached to the button, the test still fails.Which makes me feel like I haven't done the test correctly.</p>