title: running mount() in react native Not Possible?
body: <p>This post follows up with my previous question:</p>
  
  <p><a href="https://stackoverflow.com/questions/52265354/jest-test-fails-with-refs-and-form/52282510?noredirect=1#comment91513581_52282510">previous question</a></p>
  
  <p>I have come across a test which requires me to run mount in react native. I have gone through the documentation in jest and have found that before running the test suite you specifically need to setup a test environment capable of running jsdom for mount to work:</p>
  
  <p>The link to docs is:
  <a href="https://jestjs.io/docs/en/configuration#testenvironment-string" rel="nofollow noreferrer">testEnvironment</a> </p>
  
  <p>Because of it's horrible documentation. I can't figure out how to create the customEnvironment class and what after that? what do I do with the global object? How to use it in my test file which currently looks like:</p>
  
  <pre><code>describe('Estimate', () =&gt; {
    test('Estimate component Exists', () =&gt; {
      const onPressFunction = jest.fn()
      const obj = shallow(
        &lt;Estimate onPress={onPressFunction} /&gt;
      )
      expect(obj.find('TextInput').exists()).toBe(true)
    })
  
    test('Estimate returns value on button press', () =&gt; {
      const onPressFunction = jest.fn()
      const obj = shallow(
        &lt;Estimate onPress={onPressFunction} /&gt;
      )
      obj.find('TextInput').first().simulate('keypress', { key: '1' })
      obj.find('Button').first().props().onPress()
      expect(onPressFunction.toHaveBeenCalledWith('1'))
    })
  })
  </code></pre>