Current Behavior
When you change the playing prop during test (using Jest), the following error is thrown.
TypeError: Cannot read property 'play' of undefined
Expected Behavior
No Error to be thrown
Steps to Reproduce
React component
import React from 'react';
import ReactPlayer from 'react-player';
const VideoTest = ({ play }) => {
return (
<ReactPlayer
url='./test-video.mp4'
playing={!!play}
className='react-player'
width='100%'
height='100%'
style={{ lineHeight: 0 }}
/>
);
};
VideoTest.displayName = 'VideoTest';
export default VideoTest;
Test File
import React from 'react';
import { mount } from 'enzyme';
import VideoTest from './VideoTest';
describe('[molecule] VideoPlayerTest', () => {
it('testing resetting play', () => {
const wrapper = mount(<VideoTest file='http://clips.vorwaerts-gmbh.de/big_buck_bunny.mp4' />);
wrapper.setProps({ play: true });
wrapper.setProps({ play: false });
});
});
Environment
- Test runner: Jest
- Browser: JsDom
- Operating system: Windows
Current Behavior
When you change the
playingprop during test (using Jest), the following error is thrown.TypeError: Cannot read property 'play' of undefinedExpected Behavior
No Error to be thrown
Steps to Reproduce
React component
Test File
Environment