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

127
Views
Cómo probar la función pasada a los accesorios de los niños usando broma

A continuación se muestra mi componente principal desde el cual estoy pasando una función a los elementos secundarios que serán accesibles para sus módulos secundarios:

 import React from 'react'; import TestFunction from './testFunction'; const MainComponent = ({children, testId}) => { const testFunc1 = (arg1) => { const argObj = {}; argObj.arg1 = arg1; argObj.testId = testId; TestFunction(argObj); } return ( <div>{React.cloneElement(children, {testFunc: testFunc1})}</div> ) } MainComponent.propTypes = { children: PropTypes.node.isRequired, testId: PropTypes.string.isRequired, }

Se accede a este testFunc en un módulo diferente que no es accesible. Entonces, al ejecutar la prueba de ejecución de npm, testFunc1 no se cubre, no estoy seguro de cómo incluir esta función en las pruebas. Estamos usando Jest para escribir casos de prueba.

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!