title: How to Handle Subscribe in component.spec.ts Jasmine?
body: <p>I am still learn about Jasmine x Karma and I got stuck when I need to create unit testing for function which have .subscribe()
  In <strong>component.ts</strong> the code look like this</p>
  <pre><code> loadListDownloadRequestGroup() {
  this.noItem = false;
  this.listDownloadService.getDownloadRequestGroup(
    this.offsetPage,
    this.getGroupId,
    this.setOrder,
    this.keywordSend
  ).subscribe(resp =&gt; {
    const getResp: DownloadModel[] = [];
    if (resp.items.length) {
      resp.items.forEach(item =&gt; {
        const listArr: DownloadModel = {};
        listArr.id = item.id;
        listArr.queryId = item.queryId;
        listArr.createdAt = item.createdAt;
        listArr.filename = item.filename;
        listArr.queryName = item.queryName;
        listArr.widgetName = item.widgetName;
        listArr.type = item.type;
        listArr.labelName = item.labelName;
        listArr.createdByName = item.createdByName;
        listArr.expiredAt = item.expiredAt;
        listArr.status = item.status;
        listArr.group = item.group;
        listArr.groupId = item.group ? item.group.id : null;
        listArr.groupName = item.group ? item.group.name : '-';
        getResp.push(listArr);
      });
    } else {
      this.noItem = true;
      this.emptyDataText = (this.isInitGetlistData == false) ? 
        'There is no data to display' : 
        'There is no search result. Please input different keyword';
    }
    this.dataSourceDT = new MatTableDataSource(getResp);
    this.dataSourceDT.sort = this.sort;
    this.totalData = resp.total;
    this.totalOffset = Math.ceil(this.totalData / 5);
  }, (error) =&gt; {
    if (error.graphQLErrors[0].statusCode === 403) {
      this.route.navigate(['unauthorized']);
    }
  });
  </code></pre>
  <p>}</p>
  <p>on <strong>.spec.ts</strong> I write like this but it's doesn't effect the code coverage</p>
  <p>it('loadListDownloadRequestGroup', () =&gt; {</p>
  <pre><code>// const getAllDownload =  spyOn(listDownloadService, 'getAllDownload').and.callThrough();
  
  const event = { items: [{
    id: 2,
    queryId: 2,
    createdAt: '2019-09-09',
    filename: 'test',
    queryName: 'test lagi',
    widgetName: 'test widget',
    type: 'test type',
    labelName: 'test labelName',
    createdByName: 'test createdByName',
    expiredAt: '2019-08-08',
    status: 'published',
    group: {
      id: 1,
      name: 'test group'
    }
  }] };
  
  component.loadListDownloadRequestGroup();
  // expect(getAllDownload).toHaveBeenCalled();
  expect(component.isInitGetlistData).toBeFalsy();
  expect(component.noItem).toBeFalsy();
  expect(event.items.length).toEqual(1);
  </code></pre>
  <p>})</p>