I found an issues in the user-event github and it says its resolved in version 12.0.1 but I'm on version 12.1.5 and I keep getting the error.
import React, { Fragment } from "react";
import { render, act } from "@testing-library/react";
import userEvent from "@testing-library/user-event";
import App from "./App";
test("Gets a code and renders it in a new route", () => {
const { getByLabelText } = render(<App />);
act(() => {
userEvent.type(getByLabelText("Code:"), "12345");
});
expect(getByLabelText("Code:")).toHaveValue("12345");
});
● Gets a code and renders it in a new route
expect(element).toHaveValue(12345)
Expected the element to have value:
12345
Received:
5
userEvent.type("example", { delay: 1})