Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

134
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda