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

376
Views
React Hooks: se agotó el tiempo de espera durante la prueba unitaria waitForValueToChange
export function useTimer(initValue: number, isProceed: boolean) { const [value, setter] = useState(initValue) useEffect(() => { setter(initValue) const interval = setInterval(() => { if (isProceed && value > 0) setter((c) => c - 1) else if (value < 0) { clearInterval(interval) } }, 1000) return () => { clearInterval(interval) } }, [initValue, value, isProceed]) return { seconds: value > 0 ? `${Math.floor(value / 60)}:${value % 60 < 10 ? '0' : ''}${value % 60}` : '', resetTimer: () => setter(initValue), } } test('InitialCountState < 0', async () => { const { hydrate, result, waitForValueToChange } = renderHook(() => useTimer(InitialCountState, isStartTimer) ) InitialCountState = -1 isStartTimer = true hydrate() await waitForValueToChange(() => result.current.seconds) expect(result.current.seconds).toBe('') })

Se agotó el tiempo de espera en waitForValueToChange después de 1000 ms.

No se pudo resolver el resultado de la falla durante la prueba de ganchos. Se dice que falló porque fue por exceso de tiempo, pero no sé cómo solucionarlo. ¿Hay una buena manera?

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!