Open hueniverse opened 2 years ago
Good question ... I don't think jest is very useful ... It is possble to add a string describing player state in JS which describe player state, and then test with appium
Good question ... I don't think jest is very useful ... It is possble to add a string describing player state in JS which describe player state, and then test with appium
I don't think it's possible to test a native module with jest.
However, you can test if the props are passed / changed correctly after mocking the library.
jest.mock('react-native-video', ()=> 'ReactNativeVideo')
.
Only problem is I cannot test the behaviour of ref
s like ref.seek
.
If anyone has a good solution, I would like to know.
Hello did someone find a solution to test it ?
By using this below mock we can test react-native-video:
jest.mock('react-native-video',()=>{
const React = require('react');
class Video extends React.Component {
constructor(props:any){
super(props);
this.seek = this.seek.bind(this);
}
seek(){}
render(){
return React.createElement('Video',this.props,null);
}
}
return Video;
})
@laughingdevil thank you for this peace of code ! In fact there are 2 topics.
I have no clue how to write tests for a React Native module like this but I would assume it's possible...
Anyone wants to take a first stab at setting up some tests? Anything at all would be fantastic! I am all ready with a
test
label!