react-testing
Installation
SKILL.md
React Testing
Quick Start
import { render, screen } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
test("submits form with user input", async () => {
const user = userEvent.setup();
render(<LoginForm />);
await user.type(screen.getByLabelText(/email/i), "test@example.com");
await user.click(screen.getByRole("button", { name: /sign in/i }));
expect(await screen.findByText(/welcome/i)).toBeInTheDocument();
});