I am trying to write Jest tests for a React component that contains a DashJS media player. I use the Enzyme mount method to try and test the component, but it seems that the DashJS media player was not able to mount correctly.
In my componentDidMount method, I have the following code:
this.videoManager = dashjs.MediaPlayer().create(); this.videoManager.initialize(this.videoPlayer, videoUrl, true); // Where this.videoPlayer is a reference to an HTML <video> element this.videoManager.preload();
The following error appears on the last line ( this.videoManager.preload(); ):
Before calling this method, you must first call attachSource () with a valid source,
When I run the component, it works fine - these are just the tests that I am having problems with. I could not find any related problems / solutions on the Internet.
I use the following versions of each respective package:
react: "16.2.0"dashjs: "2.6.7"jest: "22.3.0"enzyme: "3.3.0"enzyme-adapter-react-16: "1.1.1"
Any help would be appreciated!
source share