Commit c0e12e58 authored by FlavGr's avatar FlavGr
Browse files

Ex 9 : Testing LoginForm

parent 0217859f
import { render, screen } from "@testing-library/react";
import React from "react";
import userEvent from "@testing-library/user-event";
import LoginForm from "../components/LoginForm";
test("it should call its onClick prop when clicked", async () => {
const handleClick = jest.fn();
render(<LoginForm onSubmit={handleClick} />);
// On simule le click
await userEvent.click(screen.getByText("Connexion"));
expect(handleClick).toHaveBeenCalled();
});
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment