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

202
Views
Prueba de broma que causa un error de 'evento sintético' al verificar que se invocó una función espiada con un objeto que contiene 'objetivo actual'

Tengo una función como esta:

 const doThingWithTarget = (event, someBoolean) => { if(someBoolean) otherFunction(event.currentTarget); // uses currentTarget } // more code ... return (<Button onClick={event => doThingEithEvent(event, true)}>Click me!</Button>)

Y tengo que probar que se hizo clic en este botón, y quería asegurarme de que el primer argumento tiene un objetivo actual:

 expect(doThingWithTarget).toHaveBeenCalledWith( expect.objectContaining({ currentTarget: expect.any(Function) }), true, );

Pero reaccionar me detecta accediendo al currentTarget en el elemento sintético y arrojando un error.

¿Cómo puedo evitar eso? No debería estar fallando.

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!