title: Test concurrent call of the same function
body: <p>I have a function:</p>
  
  <pre><code>var inRendering = false;
  function render() {
    if (inRendering) {
      requestAnimationFrame(render);
    } else {
      inRendering = true;
      requestAnimationFrame(function () {
        longAction();
        inRendering = false;
      });
    }
  }
  </code></pre>
  
  <p>I have to unit-test it. To test a situation of concurrent call of <code>render</code>.</p>
  
  <p>Help me, please? Is such concurrent call ever possible in JavaScript? Thanks.</p>
  
  <p>P.S. I wrote a test which obviously doesn't work (see comment): <a href="https://gist.github.com/kuraga/b0aa3d66fc0620f03b11" rel="nofollow">https://gist.github.com/kuraga/b0aa3d66fc0620f03b11</a></p>