Skip to content

Instantly share code, notes, and snippets.

@bengrunfeld
Last active May 11, 2021 11:41
Show Gist options
  • Save bengrunfeld/a11d99211294cbe15fafd4a4b408b698 to your computer and use it in GitHub Desktop.
Save bengrunfeld/a11d99211294cbe15fafd4a4b408b698 to your computer and use it in GitHub Desktop.
React Testing Library - getByText
import { render, screen } from '@testing-library/react'
import { App } from './App'
test("Render the App component", () => {
render(<App />)
expect(screen.getByText("Give me cookies!")).toBeInTheDocument()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment