title: How to spy on default prop function in Jest
body: <p>I'm trying to test a default prop which is a function type but not sure how to do that with Jest mocking or spying:</p>
  
  <p>Trying following test:</p>
  
  <pre><code>it("should call default toggle function prop on click of footer button", () =&gt; {
              const wrapper = shallow(
                  &lt;InfoModal
                      isOpen={true}
                      message="Primary message"
                      secondaryMessage="Secondary message"
                  /&gt;
              );
              const footerButton = wrapper.find("ModalFooter Button");
              const fn = jest.spyOn(wrapper.props(), "toggle");
              footerButton.simulate("click");
              wrapper.update();
              expect(fn).toHaveBeenCalled();
          });
  </code></pre>
  
  <p>It says <strong>TypeError: Cannot assign to read only property 'toggle' of object '[object Object]'</strong> where toggle is a function as default prop of <code>InfoModal</code>.</p>
  
  <p>How can we test a function prop which has been set default not user defined.</p>