I need help in unit testing. for the code. I want to cover this code in angular spec file by writing unit test

loadRefreshStatus(apiUrl, actionItemParam, httpGetOptions): void {

    for (const val of actionItemParam) {
      for (const inventory of this.inventory) {
        if (val.SID === inventory.SID) {
          inventory.Status = 'Refreshing';
          this.loadSucceeded(this.inventory);
        }
      }
      this.http.get(apiUrl + '/' + val.ProviderId + '/' + val.SID + '/info', httpGetOptions).map(data => data).subscribe(data => {
        const resData = data;
        for (const inventory of this.inventory) {
          if (resData.SID === inventory.SID) {
            inventory.Status = resData.status;
            //Delux table is losing context here and hence change detation is not working.
            //Ensuring that delux table gets the context back
            const dt = document.getElementById('inventory-listing_carbon-data-table-deluxe'); //ID of delux data table
            dt.click(); //restoring context back
            this.loadSucceeded(this.inventory);
          }
        }
      },
      errresourceData => {
        this.handleError(errresourceData)
      });
    }
  }

0 Answers