-
-
Save agustinfece/e8d994f9362299cd8a538ddb3eda204e to your computer and use it in GitHub Desktop.
App2.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { render, screen, fireEvent } from '@testing-library/react'; | |
import App from './App'; | |
test('changes application state', () => { | |
render(<App />); | |
const buttonElement = screen.getByRole('button'); | |
expect(buttonElement).toBeInTheDocument(); | |
expect(screen.queryByText('Click the button')).toBeInTheDocument(); | |
expect(screen.queryByText('Pressed!')).toBeNull(); | |
fireEvent.click(buttonElement); | |
expect(screen.queryByText('Click the button')).toBeNull(); | |
expect(screen.queryByText('Pressed!')).toBeInTheDocument(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment