title: Jest test callback promise
body: <p>I want to test the following <code>storeCache</code> function. 
  The critical part I want to test is the callback function in <code>Meteor.call(...)</code>.</p>
  
  <p>I want to mock <code>Meteor.call(...)</code> but it is wrapped by a Promise and the callback itself also relies on the wrapping Promise.</p>
  
  <pre><code> export async function storeCache(cache) {
      // do something
      return new Promise((resolve, reject) =&gt; {
          Meteor.call("transferCache", cache, async (error, result) =&gt; {
          if (error) {
              reject(error);
          } else {
              try {
                  const result = await persistCache();
                  resolve(result)
              } catch (e) {
                  reject(e);
              }
          }
      });
  });
  </code></pre>
  
  <p>}</p>
  
  <p>What is the best way to test the defined callback function via Jest?
  Or is there a better way to structure the Code to make it easiert to test?</p>