Something went wrong. Try again.
[READ-ONLY] Mirror of https://github.com/wojtekmaj/vitest-react-native. Run React Native unit and component tests with Vitest
Something went wrong. Try again.
750 B · 20 lines
TSX
at main
123456789101112131415161718192021import { describe, expect, it } from 'vitest';import AsyncStorage from '@react-native-async-storage/async-storage';import { fireEvent, render, screen } from '@testing-library/react-native';
import App from './App.js';
describe('<App /> component', () => { it('should save state through an animated screen and navigates to another tab', async () => { await render(<App />);
await fireEvent.press(screen.getByRole('button', { name: 'Save counter' }));
expect(await screen.findByText('Saved: 1')).toBeOnTheScreen(); expect(await AsyncStorage.getItem('count')).toBe('1');
await fireEvent.press(screen.getByText('Details', { exact: true }));
expect(await screen.findByText('Details screen')).toBeOnTheScreen(); });});