ag-grid unit testing using jasmine karma in angular9

I have defined my ag-grid as follows:
.HTML page:

<button (click)="getSelectedRows()">Get Selected Rows</button>

<ag-grid-angular
#agGrid
    style="width: 500px; height: 500px;"
    class="ag-theme-alpine"
    [rowData]="rowData | async"
    [columnDefs]="columnDefs"
    rowSelection="multiple"
    >
</ag-grid-angular>

the TS page:

import { HttpClient } from '@angular/common/http';
import { Component, OnInit, ViewChild } from '@angular/core';
import { GridOptions } from 'ag-grid-community';
import { AgGridAngular } from 'ag-grid-angular';


@Component({
  selector: 'app-samplegrid',
  templateUrl: './samplegrid.component.html',
  styleUrls: ['./samplegrid.component.scss']
})
export class SamplegridComponent implements OnInit {
  @ViewChild('agGrid') agGrid: AgGridAngular;


 columnDefs = [
  {headerName: 'Make', field: 'make', sortable: true, filter: true,
  checkboxSelection: true},
  {headerName: 'Model', field: 'model', sortable: true, filter: true},
  {headerName: 'Price', field: 'price', sortable: true, filter: true}
];
rowData: any;

  constructor(private http:HttpClient) { }

  ngOnInit(){
    this.rowData = this.http.get('https://raw.githubusercontent.com/ag-grid/ag-grid/master/grid-packages/ag-grid-docs/src/sample-data/smallRowData.json');
    
    
  }
  getSelectedRows(){
    const selectedNodes = this.agGrid.api.getSelectedNodes();
        const selectedData = selectedNodes.map( node => node.data );
        const selectedDataStringPresentation = selectedData.map( node => node.make + ' ' + node.model).join(', ');
        alert(`Selected nodes: ${selectedDataStringPresentation}`);
        return selectedDataStringPresentation;
    }
  }

My requirement is to perform unit testing for this component to check cell content and also when the particular row is selected.

I have written my test scripts as follows:

it('the grid cells should be as expected', () => {
  const appElement = fixture.nativeElement;
  const cellElements = appElement.querySelectorAll('.ag-cell-value');
  console.log(cellElements,"agGrid");
  expect(cellElements.length).toEqual(9);
  expect(cellElements[0].textContent).toEqual("Toyota");
  expect(cellElements[1].textContent).toEqual("Celica");
  expect(cellElements[2].textContent).toEqual("35000");
});

this is failing with error :TypeError: Cannot read property ‘textContent’ of undefined

Also i am trying to imitate a select event and in order to get the selectd row i have written a test script as :

 it('getting the selected row data from the grid.', () => {
    fixture.detectChanges();
    expect(component.agGrid.api).toBeTruthy();
    let user_Data=component.agGrid.api.getSelectedRows();
    expect(user_Data).toBeDefined();
    console.log(user_Data,"@ user_Data")
    
});

this is not failing but throwing user_data as blank.I wanted to know if there is any particular way of mocking data for ag-grid or mock ag-grid as a whole for unit testing purpose.
ANy help is welcomed.TIA.

Source: New feed
Source Url ag-grid unit testing using jasmine karma in angular9