title: If 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.</p>
  <p>Is there a way to unit test if blocks so that they would be covered in code coverage report?</p>
  <p>below is the code ts file :</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>onSubscribe(): void {
    this.menuData$.subscribe((menuValue): void =&gt; {
      this.menuList = MenuUtils.menuformt(menuValue, this.data);
      this.menuList &amp;&amp; this.menuList.map((element: MenuList) =&gt; {
        if (this.router.url.includes(element.url)) {
          element.active = true;
        } else {
          element.active = false;
        }
      })
    });
  }</code></pre>
  </div>
  </div>
  </p>
  <p>Below is the unit testing code:</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('onSubscribe', (): void =&gt; {
    it('should call onSubscribe', fakeAsync(() =&gt; {
      spyOn(component, 'onSubscribe').and.callThrough();
      fixture.detectChanges();
      component.onSubscribe();
      expect(component.onSubscribe).toHaveBeenCalled();
    }));
  
    const menu: MenuList = menuList[0];
    const menuListdata: MenuList[] = menuList;
    it('should includes url', fakeAsync(() =&gt; {
      const router = TestBed.get(Router);
      const mockUrlTree = router.parseUrl('/booking/_m/sites/56793/services');
      router.currentUrlTree = mockUrlTree;
      store.refreshState();
      fixture.detectChanges();
      component.onSubscribe();
      menuList.forEach((element) =&gt; {
        expect(router.url).toContain(element.url)
      });
    }));
    it('should active be true', fakeAsync(() =&gt; {
      const router = TestBed.get(Router);
      const mockUrlTree = router.parseUrl('/booking/_m/sites/56793/services');
      router.currentUrlTree = mockUrlTree;
      store.refreshState();
      fixture.detectChanges();
      component.onSubscribe();
      menuList.forEach((element) =&gt; {
        if (expect(router.url).toContain(element.url)) {
          expect(element.active).toBe(true);
        }
      });
    }));
    it('should active be true', fakeAsync(() =&gt; {
      const router = TestBed.get(Router);
      const mockUrlTree = router.parseUrl('/booking/_m/sites/56793/login');
      router.currentUrlTree = mockUrlTree;
      store.refreshState();
      fixture.detectChanges();
      component.onSubscribe();
      menuList.forEach((element) =&gt; {
        if (expect(router.url).not.toContain(element.url)) {
          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>