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

115
Views
.text() devolviendo "<Button />" en lugar del texto del botón

Básicamente lo que está en el título. Tengo el siguiente código en un componente para el que estoy escribiendo una prueba:

<Button>Edit</Button> // <- Material UI Button component

Y esta línea en mi prueba está fallando:

expect(wrapper.find(Button).text()).to.equal("Edit");

con este error:

 assert.strictEqual(received, expected) Expected value to strictly be equal to: "Edit" Received: "<Button />" Message: expected '<Button />' to equal 'Edit'

¿Alguna idea de lo que podría estar pasando?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Creo que lo que estás tratando de hacer es algo como esto:

 import { render, within } from '@testing-library/react'; import {Button} from '../components' it('renders a button with "Edit" label', () => { const { container } = render(<Button />); const { getByText } = within(container); expect(getByText('Edit')).toBeInTheDocument(); });
about 4 years ago · Juan Pablo Isaza Report
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!