Last active
June 12, 2021 20:47
-
-
Save ahayes91/55e15c587c9f84301855efc00420df85 to your computer and use it in GitHub Desktop.
Starter file needed for an app-level integration test.
This file contains hidden or 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 } from '@testing-library/react'; | |
import userEvent from '@testing-library/user-event'; | |
import getAndSetupServer from './getAndSetupServer'; | |
import App from './App'; | |
getAndSetupServer(); | |
describe('Posts app: ', () => { | |
test('renders button and mocked post in a table on button click', async () => { | |
render(<App />); | |
const button = screen.getByRole('button', { name: 'Click me to fetch posts!' } ); | |
expect(button).toBeInTheDocument(); | |
userEvent.click(button); | |
await screen.findByRole('columnheader', { name: 'Title'}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment