title: If else statement not covered in Code Coverage in Jasmine
body: <p>When I use Jasmine marbles for unit testing for if condition those specific blocks don't cover in code coverage report.
  Is there a way to unit test if blocks so that they would be covered in code coverage report?</p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>activeClass(menu: MenuList): void {
    this.menuList &amp;&amp; this.menuList.map((element: MenuList) =&gt; {
      if (element.menu_name === menu.menu_name) {
        element.active = true;
        this.gotoSelectedRoute(element);
      } else {
        element.active = false;
      }
    });
  }</code></pre>
  </div>
  </div>
  </p>
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const menuList: MenuList[] = [{
    menu_name: 'MENU_LIST.NEW_BOOKING',
    class: '',
    url: 'services',
    is_hosted: true,
    is_shown_login: true,
    showOnCondition: 'isHostedWithLogin',
    is_hide_login: true,
    hidden: false,
    displayOrder: 1,
    options: null,
    active: false,
  }, ];
  describe('activeClass', (): void =&gt; {
    const menu: MenuList = menuList[0];
    const menuListdata: MenuList[] = menuList;
    it('should call activeClass', fakeAsync(() =&gt; {
      selectMenuDataMock.setResult(menuList);
      store.refreshState();
      fixture.detectChanges();
      component.activeClass(menuList[0]);
      expect(component.activeClass).toBeTruthy();
    }));
  
    it('should both the menu name needs to be same', fakeAsync(() =&gt; {
      selectMenuDataMock.setResult(menuList);
      store.refreshState();
      fixture.detectChanges();
      component.activeClass(menu);
      menuList.forEach((element) =&gt; {
        element.menu_name = 'MENU_LIST.NEW_BOOKING';
        menu.menu_name = 'MENU_LIST.NEW_BOOKING';
        expect(element.menu_name).toEqual(menu.menu_name);
      });
    }));
  
    it('should active be true', fakeAsync(() =&gt; {
      selectMenuDataMock.setResult(menuList);
      store.refreshState();
      fixture.detectChanges();
      component.activeClass(menu);
      menu.active = true;
      menuList.forEach((element) =&gt; {
        expect(element.active).toBe(true);
      });
    }));
  
    it('should gotoselected', fakeAsync(() =&gt; {
      selectMenuDataMock.setResult(menuList);
      store.refreshState();
      fixture.detectChanges();
      component.activeClass(menu);
      const spy = spyOn(component, 'gotoSelectedRoute').and.callThrough();
      menuList.forEach((element) =&gt; {
        element.active = true;
        component.gotoSelectedRoute(element);
        expect(spy).toHaveBeenCalledWith(element);
      });
    }));
  
    it('should active be false', fakeAsync(() =&gt; {
      selectMenuDataMock.setResult(menuList);
      store.refreshState();
      fixture.detectChanges();
      component.activeClass(menu);
      menu.active = false;
      menuList.forEach((element) =&gt; {
        expect(element.active).toBe(false);
      });
    }));
  
  });</code></pre>
  </div>
  </div>
  </p>
  <p>Not sure whether the coding style for unit testing is correct or not let me know if needed any improvement.</p>
  <p>from above ts file from if block code is not covered not sure where i am going</p>
  <p>this is case i am trying to write it Thanks.</p>
  <p><a href="https://i.stack.imgur.com/zCj9o.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/zCj9o.png" alt="enter image description here" /></a></p>