title: I was testing a react functional component and the below lines which were outside the return were not getting covered
body: <p>This is just an example and I have all the necessary imports and all the code. The code inside the if-else blocks was not getting covered while writing test cases.</p>
  <pre><code>  function MyComponent() {
    const title = '';
    if (window.location.pathname === '/dashboard') {
        title= &quot;dashboard&quot;
    } else if (window.location.pathname === '/home') {
      title= &quot;home&quot;
    } else if (window.location.pathname === '/about') {
      title= &quot;about&quot;
     }
   return(
     &lt;h1&gt;{title}&lt;/h1&gt;
   )
    
  }
  </code></pre>