Este sitio utiliza cookies y/o tecnologías similares que almacenan y recuperan información cuando navegas.
En general, estas tecnologías pueden servir para finalidades muy diversas, como, por ejemplo, reconocerte como usuario,
obtener información sobre tus hábitos de navegación, o personalizar la forma en que se muestra el contenido. Los
usos concretos que hacemos de estas tenologías se describen en Política de Cookies.
React Testing Library And Jest- The Complete Guide Online
import userEvent from '@testing-library/user-event' test('form submission', async () => const user = userEvent.setup() render(<LoginForm />)
import '@testing-library/jest-dom/vitest' // or 'jest-dom' Component to test ( Button.jsx ) export const Button = ( onClick, children, disabled = false ) => ( <button onClick=onClick disabled=disabled> children </button> ) Test file ( Button.test.jsx ) import render, screen from '@testing-library/react' import userEvent from '@testing-library/user-event' import Button from './Button' test('renders button with children and handles click', async () => const handleClick = jest.fn() const user = userEvent.setup() React Testing Library and Jest- The Complete Guide
// Async (for elements that appear later) await screen.findByText('Loaded') async () =>