File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -22,15 +22,16 @@ This library is a replacement for [Enzyme](http://airbnb.io/enzyme/).
22
22
import { render } from ' react-native-testing-library' ;
23
23
import { QuestionsBoard } from ' ../QuestionsBoard' ;
24
24
25
- function setAnswer (getAllByName , index , answer ) {
26
- getAllByName ( ' Question ' )[index] .props .onChangeText (answer);
25
+ function setAnswer (question , answer ) {
26
+ question .props .onChangeText (answer);
27
27
}
28
28
29
29
test (' should verify two questions' , () => {
30
30
const { getAllByName , getByText } = render (< QuestionsBoard {... props} / > );
31
+ const allQuestions = getAllByName (' Question' );
31
32
32
- setAnswer (getAllByName, 0 , ' a1' );
33
- setAnswer (getAllByName, 1 , ' a2' );
33
+ setAnswer (allQuestions[ 0 ] , ' a1' );
34
+ setAnswer (allQuestions[ 1 ] , ' a2' );
34
35
35
36
getByText (' submit' ).props .onPress ();
36
37
You can’t perform that action at this time.
0 commit comments