-
Notifications
You must be signed in to change notification settings - Fork 277
Closed
Labels
good first issueGood for newcomersGood for newcomers
Description
Versions
"react": "16.8.3",
"react-native": "0.59.0",
"react-native-testing-library": "^1.6.0",
"react-test-renderer": "^16.8.4"
Description
getAllByTestId appears to be missing, it is listed as a query in the docs.
Reproducible Demo
src:
import React from 'react';
import { Text, View } from 'react-native';
const OptionList = ({ options }) => {
const renderOptions = (optionList) => {
return optionList.map(visibleOption => (
<Text
key={option.id}
testID="optionContainer"
>
{option.text}
</Text>
));
};
return (
<View>
{renderOptions(options)}
</View>
);
};
export default OptionList;
spec:
import React from 'react';
import { Text } from 'react-native';
import { render } from 'react-native-testing-library';
import OptionList from 'src/components/OptionList';
const buildTestProps = props => ({
options: [
{ id: 1, text: 'Frodo Card' },
{ id: 2, text: 'Gandalf Card' },
{ id: 3, text: 'Sauron Card' },
{ id: 4, text: 'Elrond Card' },
{ id: 5, text: 'Pippin Card' }
],
...props
});
let props;
let wrapper;
beforeAll(() => {
props = buildTestProps();
wrapper = render(<SwipeSelect {...props} />);
});
describe('SwipeSelect', () => {
it('renders the options', () => {
expect(wrapper.getAllByTestId(Text).length).toEqual(5);
});
});
Metadata
Metadata
Assignees
Labels
good first issueGood for newcomersGood for newcomers