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

263
Views
reaccionar probando broma: no se pueden establecer propiedades de nulo (configuración de HTML interno)

Soy nuevo en las pruebas unitarias. Sigo recibiendo este error y no estoy seguro de por qué. Los otros casos que he visto no están relacionados con la broma. Entonces, ¿cuál es la solución para mí? ¿Está dentro del componente o acabo de escribir mal la prueba?

Esta es la llamada de búsqueda en el componente

 const [data, setData] = useState(null); const [isLoading, setLoading] = useState(false); useEffect(() => { setLoading(true) const fetchList = async () => { const newList = await fetch("https://api.github.com/search/repositories?q=created:%3E2017-01-10&sort=stars&order=desc") .then((res) => res.json()) .then((data) => { setData(data) setLoading(false) }) } fetchList() }, [500]); if (isLoading) return <p className='text-white text-3xl text-center'>Loading...</p> if (!data) return <p className='text-white text-3xl text-center'>No profile data</p>

esta es la prueba

 import RepoList from '../components/RepoList' import {render, screen, act} from '@testing-library/react' import '@testing-library/jest-dom/extend-expect' global.fetch = jest.fn(()=> Promise.resolve({ json: () => Promise.resolve({ name : "name" , value: "Repo Name" }) }) ); describe("RepoList", ()=> { it("loads the data on click", async () => { await act( async () => render(<RepoList/>)) expect(screen.getByText("Repo Name")).toBeInTheDocument() }) });
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!