title: Cannot read property of an undefined object in a IF statement in JEST
body: <p>I have a simple if-else statement as</p>
  
  <pre><code>if(this.props.params.id){
      //do something
  }
  </code></pre>
  
  <p>Now, this works fine in the browser.
  If there is an id in the params it enters the if clause and doesn't if there is no id.</p>
  
  <p>Now while writing test with jest, when the id is not defined it throws an error:
  "Cannot read property 'id' of undefined"
  Why is this happening, shouldnt it treat it as false? 
  It works fine in the browser, just in the testing it throws an error.</p>