In my components I have code like this:
this.videoRef.current.pause();
Where videoRef
is <video ref={this.videoRef} autoPlay muted > ...
When Is pause
reached in test, I am getting a error:
Error: Not implemented: HTMLMediaElement.prototype.pause
How can I mock pause function?
const wrapper = mount(<ComponentWithVideoTag />);
const el = wrapper.find('video').props();
Object.defineProperty(el, 'paused', {
writable: true,
value: jest.fn(),
});
Not working for me.
Aucun commentaire:
Enregistrer un commentaire