The following worked for me:
import userEvent from "@testing-library/user-event";
import { render } from "@testing-library/react";
test("should submit when pressing enter", () => {
const handleSubmit = jest.fn();
const { getByLabelText } = render(<App handleSubmit={handleSubmit} />);
const input = getByLabelText("Name:");
userEvent.type(input, "abc{enter}");
expect(handleSubmit).toHaveBeenCalled();
});