title: Using mjackson's expect spyOn on function from React component's props
body: <p>I'm getting an error <code>TypeError: Cannot assign to read only property 'onFocus' of object '#&lt;Object&gt;'</code> when I am trying to use expect spyOn on a function from props, probably because of spyOn behaviour.</p>
  
  <pre><code>it('handleFocus', () =&gt; {
        const wrapper = setup()
        const spy = spyOn(wrapper.props(), 'onFocus')
        wrapper.instance().handleFocus()
        expect(spy).toHaveBeenCalled()
  })
  </code></pre>
  
  <p>There is the setup function</p>
  
  <pre><code>const setup = (isMount) =&gt; {
      const props = {
        value: 'test',
        promise: () =&gt; Promise.resolve({}),
        access: () =&gt; {},
        onFocus: () =&gt; {},
        onChange: () =&gt; {},
        onUpdateInput: v =&gt; v
      }
      return isMount
        ? mount(&lt;AutoCompleteAsync {...props} /&gt;)
        : shallow(&lt;AutoCompleteAsync {...props} /&gt;)
    }
  </code></pre>
  
  <p>and there you can find the handleFocus function</p>
  
  <pre><code>handleFocus () {
      const { onFocus, onInputFocus } = this.props
      if (onInputFocus) {
        onInputFocus()
      }
      onFocus()
    }
  </code></pre>