Created
March 4, 2022 23:06
-
-
Save ozcanzaferayan/f813bda24481c90a888c1a75bf30a6bf to your computer and use it in GitHub Desktop.
Testing react components - Repos.test.tsx
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 { fireEvent, render, screen } from "@testing-library/react"; | |
import Repos from "./Repos"; | |
test("renders user's repos", async () => { | |
render(<Repos />); | |
const button = screen.getByText(/Get repos/i); | |
fireEvent.click(button); | |
const txtRepo = await screen.findByText(/boysenberry/i); | |
expect(txtRepo).toBeInTheDocument(); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment