Я пытаюсь смоделировать свою функцию, используя модульное тестирование, я не могу получить покрытие кода в функции
public startimer()
{
this.isRunning = true;
this.MinuteScreenSaverSubscription = this.idle.onInterrupt.subscribe(()=> {
this.MinuteScreenSaverSubscription.unsubscribe();
this.idle.setTimeout(false);
this.idle.stop();
this.idle.setIdleName('screenSaverIdle');
this.idle.setIdle(1);
this.idle.setTimeout(10);
this.idle.onTimeout.subscribe(() => {
this.triggerScreenSaver();
});
});
this.idle.setInterrupts(DEFAULT_INTERRUPTSOURCES);
this.idle.watch();
}
Тест:
describe('startScreenSaverTimer', () => {
it('should set the tenMinuteScreenSaverSubscription', () => {
// act
this.instance.startScreenSaverTimer();
// assert
expect(this.instance['tenMinuteScreenSaverSubscription']).toBeTruthy();
});
});
используя вышеуказанный код, я не могу получить покрытие, необходимо получить полное покрытие для этой функции выше.пожалуйста, помогите в этом.