Closed
Description
Okay, so I'm brand new to react-native-testing as of this morning and have not been able to do something as simple as do getByText()
. So, I'm not going to claim this issue is a bug with the library, but a "bug" with my basic understanding of how to use it. Please help me see what I'm missing? Thanks.
Given this jest test file in my React Native 0.67.2 app:
import React from 'react';
import { Text } from 'react-native';
import { cleanup, render, RenderAPI } from '@testing-library/react-native';
describe('react-native-test example', () => {
let c: RenderAPI;
beforeEach(() => {
c = render(<Text>example</Text>);
});
afterEach(cleanup);
test('getByText()', () => {
c.debug();
expect(c.getByText('example')).toBeDefined();
});
});
Why do I get this result?
I also tried <Text>{'example'}</Text>
and getByText(/example/)
to no avail.
Versions:
"react": "~17.0.2",
"@testing-library/jest-native": "^4.0.4",
"@testing-library/react-native": "^9.0.0",
"jest": "^25.1.0",