import * as React from "react"; import { render, cleanup, Simulate } from "react-testing-library"; import UnderlineAnimation from "../components/UnderlineAnimation"; beforeEach(cleanup); describe("Underline Anmiation", () => { test("01 - component matches snapshot", () => { const { container } = render( } /> ); expect(container).toMatchSnapshot(); }); test('02: input focus', () => { const focus = jest.fn(); const { getByTestId } = render( } /> ); Simulate.focus(getByTestId('input')); expect(focus).toHaveBeenCalled(); }) });