title: Async support for functions that return an unchainable Promise<void>
body: <p>We are testing a call to a function that returns a <code>Promise&lt;void&gt;</code>. How can we wait until the promise resolves and <code>then</code> do some test? </p>
  
  <p>The standard approach of <code>then()</code> off of the function does not work, because a <code>Promise&lt;void&gt;</code> is not thenable. So we have resorted to the following, which works but seems non-ideal. </p>
  
  <p>Initial Approach</p>
  
  <pre><code>it("it does something...", function (done) {
  
      function wrappedPromise() {
          functionThatReturnsPromiseVoid(someArg);
          return new Promise((resolve) =&gt; resolve());
      }
  
      wrappedPromise()
          .then(() =&gt; {
              expect(someVar).toBe("someValue");
              done();
          });
  });
  </code></pre>
  
  <p>Subsequent Approach</p>
  
  <pre><code>let wrapVoidPromise = (wrapped): Promise&lt;any&gt; =&gt; new Promise((resolve) =&gt; {
      wrapped();
      resolve();
  });
  
  it("it does something...", function (done) {
  
      wrapVoidPromise(() =&gt; functionThatReturnsPromiseVoid(someArg))
          .then(() =&gt; {
              expect(someVar).toBe("someValue");
              done();
          });
  });
  </code></pre>
  
  <p>How can we do this without needing to wrap the unchainable promise?</p>
  
  <h1>Edits</h1>
  
  <p>Here is a <a href="https://github.com/shaunluttin/openiddict-samples/blob/60ddd693271abd1857745635f554d8dde2aeb969/samples/ImplicitFlow/AureliaOidcClientJs/test/unit/open-id/open-id-router-configuration-service.spec.ts#L48-L57" rel="nofollow">GitHub link to the actual test</a>. It includes this call:</p>
  
  <pre><code>route.navigationStrategy(instruction) // returns Promise&lt;void&gt;
  </code></pre>
  
  <p>Here is a <a href="https://github.com/aurelia/router/blob/e3a0fa3310616e79c7850b563824d6f2f59ac581/src/interfaces.js#L27-L32" rel="nofollow">GitHub link to the function</a>. The implementation is buried somewhere inside the source to aurelia-router. Here is its interface:</p>
  
  <pre><code>navigationStrategy?: (instruction: NavigationInstruction) =&gt; Promise&lt;void&gt;|void;
  </code></pre>