Question: How would I write a unit test for this in jest? I'm using Javascript. I have this code: renderEmptyList() { return ( {Alert.alert( strings('Common.error'), strings('SurveyScreen.emptyListMessage'),

How would I write a unit test for this in jest? I'm using Javascript. I have this code:

 renderEmptyList() { return (  {Alert.alert( strings('Common.error'), strings('SurveyScreen.emptyListMessage'), [ { text: strings('Common.ok'), onPress: () => this.props.navigation.goBack() } ///no code coverage ] )}  ) }

the component in question is:

export default class SurveyScreen extends React.Component { constructor(props) { super(props); const { navigation } = this.props; this.handleChangeResponse = this.handleChangeResponse.bind(this); this.handleSubmit = this.handleSubmit.bind(this); this.state = { questions: navigation.getParam('questionData', []), postData: [], }; }

how would I write unit tests for the renderEmptyList() method?

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!