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

133
Vistas
Not able to test async react-select component

I'm trying to test when the user enters some value to the input, and then it fetches some options from API to show and then I select one option out of them then form should have those values. When I ran npm test one test fails for some reason.

My code test code:

import "@testing-library/jest-dom/extend-expect";
import React from "react";
import { render, screen, fireEvent } from "@testing-library/react";
import selectEvent from "react-select-event";
import SkillSelect from "../SkillSelect";

test("React select", async () => {
  render(<SkillSelect data={[]} index="1" id="2" />);

  expect(screen.getByTestId("form")).toHaveFormValues({});
  fireEvent.change(screen.getByLabelText("Skills"), {
    target: { value: "java" },
  });
  await selectEvent.select(screen.getByLabelText("Skills"), "java");
  expect(screen.getByRole("form")).toHaveFormValues({
    label: "Javascript",
    value: "javascript",
  });
});

Error message: enter image description here

Anyone please help me with this!

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