Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

190
Vistas
UnhandledPromiseRejection error in React test

I am doing test on the React+Typescript using React Testing Library and Jest. This test could not run at all with the following error:

[UnhandledPromiseRejection: This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). The promise rejected with the reason "TypeError: Cannot read properties of undefined (reading 'json')".] { code: 'ERR_UNHANDLED_REJECTION' }

Here is my test. Please help my to fix it.

const renderComponent = (): RenderResult => {
  return render(
      <List />,
    {}
  );
};

const { getByTestId, findByTestId, findByText } = screen;

const renderElements = (): any => {
  const component = renderComponent();
  return {
    deleteIcon: screen.getByTestId("delete-icon"),
    dialogPopup: screen.getByTestId("dialog-popup"),
    component,
  };
};

describe("When click on Delete icon", () => {
  it("should show Dialog Confirmation Popup", () => {
    const { deleteIcon, dialogPopup } = renderElements();
    userEvent.click(deleteIcon);
    expect(dialogPopup).toBeInTheDocument();
  });
});
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda