Zum Hauptinhalt navigieren
Zertifizierter Händler seit über 35 Jahren
Mo.–Fr. 8:30 – 17:00 Uhr: 0 21 91 - 99 11 00
Mo.-Fr. 8:30 - 17:00 Uhr: 0 21 91 - 99 11 44
Software & Fachbücher vom Experten
Mo.-Fr. 8:30 - 17:00 Uhr: 0 21 91 - 99 11 44
0

Library/react: Testing

const button = screen.getByRole('button', name: /off/i ); await user.click(button);

Greeting.test.jsx

expect(button).toHaveTextContent(/on/i); ); For API calls or async updates: testing library/react

import render, screen, waitFor from '@testing-library/react'; import UserProfile from './UserProfile'; test('loads user data', async () => render(<UserProfile userId=1 />); const button = screen

import render, screen from '@testing-library/react'; import userEvent from '@testing-library/user-event'; import ToggleButton from './ToggleButton'; test('toggles text on click', async () => const user = userEvent.setup(); render(<ToggleButton />); const button = screen.getByRole('button'