I have some react-native/expo with native-base code that runs normally on the phone or emulator. I tried creating a test for it using jest and react-native-testing-library. When doing so, whatever is inside the from native-base is not rendered and cannot be found in the test.
Has anyone been through this and would know a solution so the children of Content are rendered during testing?
An example code is below to illustrate what I am saying. Thank you very much for the help.
import { render } from 'react-native-testing-library';
import {
Content, Container, Text
} from 'native-base';
class App extends React.Component {
render() {
return (
<Container>
<Content>
<Text testID="textId">Hello</Text>
</Content>
</Container>
);
}
}
describe('Testing Content', () => {
const { queryByTestId } = render(<App />)
it('renders text inside content', () => {
expect(queryByTestId('textId')).not.toBeNull()
});
})
The versions of the packages are:
"expo": "^32.0.0",
"react": "16.5.0",
"native-base": "^2.12.1",
"jest-expo": "^32.0.0",
"react-native-testing-library": "^1.7.0"