У меня проблема с тестами. Я получаю сообщение об ошибке: TypeError: Cannot read property 'pipe' of undefined
метод в директиве:
@HostListener('mouseenter')
onMouseenter(): void {
forkJoin([
this.dateService.formatDate(dateStart).pipe(take(1)),
this.dateService.formatDate(dateEnd).pipe(take(1))
]).subscribe((dates) => {
this.showTooltip(`${dates[0]} - ${dates[1]}`);
});
}
(formatDate возвращает наблюдаемую строку)
в тесте:
fit('should call mouse enter', () => {
directive.onMouseenter();
expect(directive.showTooltip).toHaveBeenCalled();
});
я должен как-то издеваться над трубой? Благодарность!
dateService.formatDate
возвращается? - person Andrew Allen   schedule 05.03.2020dateService.formatDate
не возвращает то, что вы ожидаете. Вы настроили макет и возвращаемое значение? - person Podge   schedule 05.03.2020dateService
издеваетесь. Если вы предоставите полный код набора тестов, я могу помочь вам смоделировать его. - person AliF50   schedule 05.03.2020