Created
January 3, 2023 15:12
-
-
Save zidniryi/c0dbb3381e5089015b45ce2cc0228fdb to your computer and use it in GitHub Desktop.
App.test.tsx Unit Test Konsep Koding
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 />); | |
//simulate filling up the textbox | |
const personNameInput: HTMLInputElement = screen.getByRole("textbox"); | |
await userEvent.type(personNameInput, "helo"); | |
await waitFor(() => expect(personNameInput).toHaveValue("helo")) | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment