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

176
Views
Cómo cubrir la función de devolución de llamada onIdle con test react-idle-timer

Yo uso react-idle-timer 4.6.4

Tengo un componente con gancho useIdleTimer .

 import {useDispatch} from "react-redux"; import {logoutRequest} from "auth/actions"; const App = () => { const dispatch = useDispatch(); const logout = () => dispatch(logoutRequest); useIdleTimer({ timeout: 1000 * 60 * 5, onIdle: logout, debounce: 500 }); return <Component /> }

Además, tengo una prueba que se ve así

 test("render App", () => { render(<App />); const someElement = screen.getByText("Some element"); expect(someElement).toBeInTheDocument(); })

Esta prueba cubre todas las líneas de código excepto la función de cierre de sesión.

¿Cómo cubrir la función de logout de sesión con pruebas?

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!