Имам проблем с тестовете. Получавам грешка: 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