title: ag-Grid: How can I access the gridApi from a Unit Test?
body: <p>I am trying to unit test a function that includes calls to the gridApi, like <code>this.gridApi.getSelectedRows();</code>. When the unit test gets to this line, it gives this error: <code>Failed: Cannot read property 'getSelectedRows' of undefined</code>, because gridApi hasn't been defined yet.</p>
  
  <p>How can I define the gridApi from a unit test? It is normally defined in the onGridReady function like this:</p>
  
  <pre><code>  onGridReady(params) {
      this.gridApi = params.api;
      this.gridColumnApi = params.columnApi;
      this.gridApi.sizeColumnsToFit();
    }
  </code></pre>
  
  <p>Is it possible to trigger <code>onGridReady</code> from a unit test? I don't know what params could be sent to it. Is there some other way to define <code>this.gridApi</code> instead?</p>