title: How to increase branch coverage in jest in for-in loop with if condition?
body: <p>I've following code, which maps few fields from an object to another and copies value: </p>
  
  <pre><code>//Function params
  var source= {"f1": "v1", "f2": "v2", "f3":"v3"};
  var fieldsMapping = {"f1": "c1", "f2":"c2"};
  
  //function definition starts
  var copiedObj = {};    
  for (var name in source) {
    if (source.hasOwnProperty(name)) { //Line X
      if(fieldsMapping[name]){
          copiedObj[fieldsMapping[name]] = source[name];
      }
    }
  }
  
  console.log(copiedObj); //outputs {c1: "v1", c2: "v2"}
  </code></pre>
  
  <p>I've written test case for this function in <code>jest</code>, with 100% line coverage but branch coverage displays <code>Line X</code> is not covered. As per <a href="https://rules.sonarsource.com/javascript/RSPEC-1535" rel="nofollow noreferrer">Standards</a> similar in <a href="https://palantir.github.io/tslint/rules/forin/" rel="nofollow noreferrer">TSLint</a>, <code>for-in</code> loop should be followed by <code>if condition</code>. </p>
  
  <p>Can anybody suggest on how to have a test case to increase <code>branch coverage</code> for this?</p>