import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; test('Button click', () => { render(); const button = screen.getByRole('button'); userEvent.click(button); });
import { render, screen } from '@testing-library/react'; import userEvent from '@testing-library/user-event'; test('Input change', () => { render(); const input = screen.getByRole('textbox'); userEvent.type(input, 'test value'); expect(input).toHaveValue('test value'); });In both examples, the tests are using the Simulate method from the react-testutils package to simulate user actions on the components being tested. The package being used is likely React Testing Library, which provides a set of utilities for testing React components.