title: Sinon and Mocha: How to await for a promised to be resolved before assertion in test function?
body: <p>I have a file where,</p>
  
  <pre><code>function fetchDevices () {
      device.findAll()
            .then(allDevices =&gt;
               console.log("Fetched for DB")
      )
  }
  </code></pre>
  
  <p>In the test file I have mocked the <code>device</code>. Now I want know/await whenever this <code>findAll()</code> returns a promise and then continue assertions in test function. I have tried many things and <code>setTimeout</code> isn't what I am looking for. </p>
  
  <p>I can not stub <code>devices</code> because I'm already mocking it with another library which saves a lot of trouble of mocking or stubbing the properties.</p>
  
  <p>Help would be very much appreciated.</p>