'this.myVideo.addEventListener is not a function : ERROR in Jasmine

I want to write a testcase for the code below:

public manage(){
      if (this.loopNum) {
      this.myVideo.addEventListener('ended', (event) => { // line 1
            this.myVideo.setAttribute('src', this.visaVideoSrc);
            this.myVideo.currentTime = 0;
              event.play();
        }
      }, false);
    }
}

line1: addEventListever is not a function.

I am trying like this:

it('should call manage()', () => {
      component.loopNum = true;
      component.manageVideoLoop();
      expect(component.loopNum).toBe(true);
    });

but here I am not able to cover "line 1" and it is showing

addEventListever is not a function



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source