title: How to test API calls in react using jest and enzyme?
body: <p>I have a React container in which I am making the API call and would like to be able to test this using jest and enzyme but unsure how to. </p>
  
  <p>This is my code:</p>
  
  <pre><code>import React from "react";
  import Search from "../../components/Search";
  import { API_KEY } from "../../../config";
  
  class SearchContainer extends React.Component {
    state = {
      articles: []
    };
  
    performSearch = event =&gt; {
      fetch(
        `http://content.guardianapis.com/search?q=${event}&amp;api-key=${API_KEY}`
      )
        .then(response =&gt; response.json())
        .then(data =&gt; this.setState({ articles: data.response.results }));
    };
  
    render() {
      return (
        &lt;Search
          performSearch={this.performSearch}
          articles={this.state.articles}
        /&gt;
      );
    }
  }
  
  export default SearchContainer;
  </code></pre>