title: How to test that the renderItem function returns a <ListItem />?
body: <p>I'm building my app with React Native and I do my unit tests with Jest and Enzyme. How can I test my <code>&lt;FlatList /&gt;</code>'s <code>renderItem()</code> function?</p>
  
  <p>It returns a <code>&lt;ListItem /&gt;</code> from the React-Native-Elements library.</p>
  
  <p>Let me give you the example code:</p>
  
  <pre><code>import { ListItem } from 'react-native-elements'
  
  export class MyList extends Component {
    const list = [
      {
        name: 'Amy Farha',
        subtitle: 'Vice President'
      },
      {
        name: 'Chris Jackson',
        avatar_url: 'https://s3.amazonaws.com/uifaces/faces/twitter/adhamdannaway/128.jpg',
        subtitle: 'Vice Chairman'
      },
      ... // more items
    ]
  
    keyExtractor = (item, index) =&gt; index
  
    renderItem = ({ item }) =&gt; (
      &lt;ListItem
        title={item.name}
        subtitle={item.subtitle}
        leftAvatar={{
          source: item.avatar_url &amp;&amp; { uri: item.avatar_url },
          title: item.name[0]
        }}
      /&gt;
    )
  
    render () {
      return (
        &lt;FlatList
          keyExtractor={this.keyExtractor}
          data={this.state.dataSource}
          renderItem={this.renderItem}
        /&gt;
      )
    }
  }
  </code></pre>
  
  <p>I would like to be able to test the <code>renderItem()</code> function. My problem is, that <code>wrapper.instance().renderItem({item: item})</code> returns the error: <code>TypeError: wrapper.instance(...).renderItem(...).find is not a function</code>. Let me give you the code of the test that I wrote:</p>
  
  <pre><code>describe("component methods", () =&gt; {
    let wrapper;
    let props;
    let item;
    beforeEach(() =&gt; {
      props = createTestProps();
      wrapper = shallow(&lt;MyList {...props} /&gt;);
    });
  
    describe("renderItem", () =&gt; {
      describe("user", () =&gt; {
        beforeEach(() =&gt; {
          item = {
            name: 'Chris Jackson',
            avatar_url: 'https://s3.amazonaws.com/uifaces/faces/twitter/adhamdannaway/128.jpg',
            subtitle: 'Vice Chairman'
          };
        });
  
        it("should display the order as a &lt;ListItem /&gt;", () =&gt; {
          expect(
            wrapper
              .instance()
              .renderItem(item)
              .find("ListItem")
          ).toHaveLength(1);
        });
      });
    });
  });
  </code></pre>
  
  <p>How would I have to write this test so that I can test if the function correctly renders a <code>&lt;ListItem /&gt;</code>?</p>