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?