title: Angular 2 Unit Test for IF condition
body: <p>I am new to unit testing. I am trying to unit test the if condition for the code below:</p>
  
  <pre><code>hide() {
          this.count --;
          if (this.count === 0) {
              this.loaderIs = false;
          }
      }
  </code></pre>
  
  <p>I am trying to use spy function on <code>loaderIs</code> variable.</p>
  
  <pre><code>it('hide function check', () =&gt; {
          expect(loaderService.hide).toBeDefined();
          spyOn(loaderService, 'loaderIs');
          loaderService.hide();
          expect(loaderService.loaderIs).toHaveBeenCalled();
      });
  </code></pre>
  
  <p>Any input and guides are highly appreciated.</p>