title: How to mock koa context in a function that returns a function with context parameter
body: <p>I have a file, <code>myFunction.ts</code> that defines and exports one function:</p>
  
  <pre><code>export function MyFunction() {
      return async (ctx: Koa.Context) =&gt; {
          //some work happens in here
      };
  }
  </code></pre>
  
  <p>This function gets called in a Koa middleware file and inherits the <code>ctx</code> from previous middleware. How does one create a mock <code>ctx</code> to test <code>MyFunction()</code> in this case?</p>