title: how to test a setTimeout in these function?
body: <p>I have a function (in node.js ) that call another a setTimeout function. And i  need test with jasmine, if   setTimeout function was call , but i dont now how to do these</p>
  
  <p>I expect test a call to the setTimeout function with jasmine</p>
  
  <pre><code>  const genOfGrid = (ctx, grid) =&gt; {
     ctx.clearRect(0, 0, fieldSize, fieldSize);
     drawGrid(ctx, grid);
     const gridOfNextGeneration = NextGeneration(grid);
     //These is the function i want to test
     setTimeout(() =&gt; {
       requestAnimationFrame(() =&gt; genOfGrid(ctx, gridOfNextGeneration));
      }, 1000 / 10);
   };
  
  //These is the test implementation but It doesn't work
  
  describe("Test settTimeout in genOfGrid", function() {
    let timerCallback;
    beforeEach(function() {
     timerCallback = jasmine.createSpy("timerCallback");
     jasmine.clock().install();
    });
    afterEach(function() {
     jasmine.clock().uninstall();
   });
  fit("causes a timeout to be called synchronously", function() {
     setTimeout(function() {
     timerCallback();
     }, 100);
     expect(timerCallback).toHaveBeenCalled();
   });
   });
  </code></pre>