mardi 17 septembre 2019

Understanding Jest Test Coverage

I'm trying to understand testing with Jest coverage.

I have simple code that sets page title and scrolls page to top, within my React page component:

useEffect(() => {
    document.title = `Page Title`;
    window.scrollTo(0, 0);
  });

Apparently, document.title and window.scrollTo is giving me 60 under % Stmts. When I comment them out, I get 100.

How can I obtain 100 % Stmts with the above code?

Aucun commentaire:

Enregistrer un commentaire