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

286
Views
¿Por qué los componentes materiales de la interfaz de usuario no se procesan en jsdom cuando se usa Jest?

Estoy usando Jest/React Testing Library para probar la interfaz de usuario.

Tengo un componente cuya declaración de devolución se ve así:

 const sidebarContentUp = ( <Drawer anchor="left" onClose={onMobileClose} open={openMobile} PaperProps={{ sx: { backgroundColor: 'background.paper', width: 280, }, }} variant="temporary" data-testid="drawer-up" > {content} </Drawer> ); const sidebarContentDown = ( <Drawer anchor="left" open PaperProps={{ sx: { backgroundColor: 'background.paper', height: 'calc(100% - 64px) !important', top: '64px !Important', width: 280, }, }} variant="persistent" > {content} </Drawer> ); return ( <> {process.env.NEXT_PUBLIC_IS_TESTING ? ( <Grid> <div>div2</div> {sidebarContentUp} {/* {sidebarContentDown} */} <div>div3</div> </Grid> ) : ( <> <Hidden lgUp>{sidebarContentUp}</Hidden> <Hidden lgDown>{sidebarContentDown}</Hidden> </> )} </> ); };

No hay atributos ocultos ni nada para sidebarContentUp , pero nunca se representa en jsdom cuando se ejecutan pruebas.

solo veo div2 y div3

No pude darme cuenta durante días.

¿Por qué no se procesa y cómo puedo solucionarlo?

Otro problema que podría dar más pistas es que cuando no tengo {sidebarContentDown} comentado, arroja un error

 Error: Uncaught [TypeError: Cannot read property 'includes' of undefined]
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!