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

359
Views
Jest/react-testing-library/React: no se puede encontrar un elemento... con llamadas asincrónicas

Recibo este error, para esta prueba:

No se puede encontrar un elemento por: [data-testid="detail-result"]

 import { render, screen, cleanup } from "@testing-library/react"; import { QueryClient, QueryClientProvider } from "react-query"; import Comp1 from "./Comp1"; import { DataProvider } from "./Context"; const queryClient = new QueryClient(); describe("Comp1 tests", () => { beforeEach(() => { jest.useFakeTimers(); }); it("Should give correct response with render", async () => { render( <QueryClientProvider client={queryClient}> <DataProvider> <Comp1 /> </DataProvider> </QueryClientProvider> ); expect(await screen.findByTestId("detail-result")).toBeInTheDocument(); }); }); afterEach(cleanup);

Sé que tiene algo que ver con la llamada api esperando que la otra termine, pero incluso con async/await me sale el error:

recreado aquí: Sandbox

about 4 years ago · Santiago Trujillo
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!