Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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