Created
January 3, 2023 15:21
-
-
Save zidniryi/05129a6dd320e02488407450cfcfcf3b to your computer and use it in GitHub Desktop.
userEvent test
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 { render, screen, waitFor } from "@testing-library/react"; | |
import userEvent from "@testing-library/user-event"; | |
import App from "./App"; | |
describe("Render app", () => { | |
test("should change input value when user type", async () => { | |
render(<App />); | |
const textInput: HTMLInputElement = screen.getByTestId("input-form"); | |
await userEvent.type(textInput, "helo"); | |
await waitFor(() => expect(textInput).toHaveValue("helo")) | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment