Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

132
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!