React & Modern Frontend (445 Qs)•Part 6: React Native Architecture (135 - 138)
How to test React Native apps?
React Native can be tested only in mobile simulators like iOS and Android. You can run the app in your mobile using expo app (https://expo.io) Where it syncs using QR code, your mobile and computer should be in same wireless network.
Practical Code Example
javascript
// Testing React Native: Jest + React Native Testing Library
import { render, screen } from '@testing-library/react-native';
import NativeApp from './NativeApp';
test('renders native greeting', () => {
render(<NativeApp />);
expect(screen.getByText('Hello iOS & Android!')).toBeTruthy();
});