Skip to content

Commit 61623dd

Browse files
committed
simplify example
1 parent 2c0b6b9 commit 61623dd

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

README.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,15 +22,16 @@ This library is a replacement for [Enzyme](http://airbnb.io/enzyme/).
2222
import { render } from 'react-native-testing-library';
2323
import { QuestionsBoard } from '../QuestionsBoard';
2424

25-
function setAnswer(getAllByName, index, answer) {
26-
getAllByName('Question')[index].props.onChangeText(answer);
25+
function setAnswer(question, answer) {
26+
question.props.onChangeText(answer);
2727
}
2828

2929
test('should verify two questions', () => {
3030
const { getAllByName, getByText } = render(<QuestionsBoard {...props} />);
31+
const allQuestions = getAllByName('Question');
3132

32-
setAnswer(getAllByName, 0, 'a1');
33-
setAnswer(getAllByName, 1, 'a2');
33+
setAnswer(allQuestions[0], 'a1');
34+
setAnswer(allQuestions[1], 'a2');
3435

3536
getByText('submit').props.onPress();
3637

0 commit comments

Comments
 (0)