title: Test run faster, then my function finish. React, Enzyme + Jest
body: <p>I try to test <code>function</code>, that after finish API request shall display <code>displayModalSuccess</code>.</p>
  <pre><code>someFunction = () =&gt; {
        displayModalLoading()
        Promise.all([execDelete(something here...)])
        .then(function(){
           displayModalSuccess()
          return({something...}.bind(this))
  </code></pre>
  <p>In my test I have tested if <code>someFunction</code> is called, and i want to find <code>succes modal</code>, but its not there yet.</p>
  <pre><code> someFunction: jest.fn().mockImplementation(() =&gt; Promise.resolve({}))
      
       .....
  
       // (my part of test related to topic)
      
       expect(someFunction).toHaveBeenCalledTimes(1);
      
       expect(wrapper.find('.t-btn-modal-delete-success').length).toEqual(1);
  
       ....
  </code></pre>
  <p>I have also put <code>console.log()</code> into code, and into test. The test <code>console.log()</code>, runs first, so that means that <code>succes modal</code> is not there yet, when test runs?</p>
  <p>How can I make this test succesfull, I guess I have to wait somehow on function to finish?</p>
  <p>Im new in testing, happy for every answer.</p>