Jest(伊斯坦布尔)的报道

时间:2018-08-05 11:05:58

标签: javascript jestjs istanbul

我正在开玩笑地为以下功能编写单元测试用例,并使用istanbul进行覆盖。这是我要为其编写单元测试用例的函数:

    updatePaginationList (forwardOrBackward) {
    let currentIndex = this.getCurrentIndexOfSelectedPage();
    currentIndex = currentIndex + forwardOrBackward;
    this.selIectedPageInPagination = this.PaginationElementList[currentIndex] ;
    **this.updateCurrentVisiblePagination(forwardOrBackward,currentIndex);**

    this.updatePaginationNextVisibility();
    this.updatePaginationBackVisibility();
  }

测试用例:

it('updateCurrentVisiblePaginationList should be called while updatePaginationList called', () => {
  let spy = jest.spyOn(searchComponent, 'updateCurrentVisiblePagination');
  searchComponent.updatePaginationList(1);
  expect(spy).toHaveBeenCalled();
});

,但以下行未包括在本报告中:

  

this.updateCurrentVisiblePagination(forwardOrBackward,currentIndex);

0 个答案:

没有答案