Skip to content

Instantly share code, notes, and snippets.

@ozcanzaferayan
Created March 4, 2022 23:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ozcanzaferayan/f813bda24481c90a888c1a75bf30a6bf to your computer and use it in GitHub Desktop.
Save ozcanzaferayan/f813bda24481c90a888c1a75bf30a6bf to your computer and use it in GitHub Desktop.
Testing react components - Repos.test.tsx
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