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

350
Views
React Native Testing Library muestra una advertencia por usar `waitFor`

Tengo esta prueba con Jest y react-native-testing-library

 it('submits form on submit button press', async () => { const onSubmit = jest.fn(); const values = { username: 'jack' }; const { getByRole } = render( <Form initialValues={values} onSubmit={onSubmit} />, ); const button = getByRole('button'); fireEvent.press(button); await waitFor(() => { expect(onSubmit).toBeCalledWith(values, expect.anything()); }); });

Pasa, pero tira este aviso

 Warning: You seem to have overlapping act() calls, this is not supported. Be sure to await previous act() calls before making a new one.

NOTA: si waitFor la advertencia desaparece pero la prueba falla porque no llama a la función onSubmit inmediatamente.

about 4 years ago · Juan Pablo Isaza
2 answers
Answer question

0

Cambiar el ajuste preestablecido de Jest de "react-native" a "@testing-library/react-native" resolvió el problema.

about 4 years ago · Juan Pablo Isaza Report

0

Trata de cambiar

 await waitFor(() => { expect(onSubmit).toBeCalledWith(values, expect.anything()); });

a

 waitFor(() => { expect(onSubmit).toBeCalledWith(values, expect.anything()); });
about 4 years ago · Juan Pablo Isaza Report
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!