Testing Library/react !link! -
import render, screen, waitFor from '@testing-library/react'; import UserProfile from './UserProfile'; test('loads user data', async () => render(<UserProfile userId=1 />);
Greeting.test.jsx
expect(button).toHaveTextContent(/on/i); ); For API calls or async updates: testing library/react