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

237
Views
Cobertura de prueba descubierta para probar la declaración if en reaccionar

Tengo un evento de envío de formulario en React, luego se redirige a una URL usando el historial

 const handleFormSubmit = (e) => { e.preventDefault(); if (query) history.push(query); //here is uncovered }; <Form onSubmit={handleFormSubmit}>

Lo estoy probando usando react-testing-library

 it("should type input and redirect if submitted", async () => { fireEvent.change(screen.getByPlaceholderText(/your name/i), { target: { value: query }, }); await screen.findByDisplayValue(query); }); it("should submit the search form", async () => { fireEvent.click(screen.getByText(/submit/i)); expect(await history.location.pathname).toBe("/" + query); });

La prueba está pasando, pero el informe de cobertura en broma muestra history.pushState(query) está descubierto. ¿Supongo que es por la declaración if?

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!