title: Mock an if/else statement with jasmine - unit testing with Angular/Typescript
body: <p>I have added a minor amendment within an existing function. Our quality checks have identified this as new code therefore I need to cover the new 4 lines with a unit test - within mind there was never a unit test there to begin with and the function I added to is pretty large!</p>
  <p>I've tried a number of ways to try and mock services, variables, spying etc... but always get errors. I'm new to jasmine so struggling. All I need to do is get any sort of check to cover the lines truthy/falsy.</p>
  <p><strong>component.ts file</strong></p>
  <pre><code>hasDescription() {
          return this.isBrilliant() || this.isCool();
      }
  
  isBrilliant() {
          return this.service.Type.description == 'Brilliant';
      }
  
  isCool() {
          return this.service.Type.description == 'Cool';
      }
  
  
  
  onExportToExcel(): void {
          var r = [];
          // added the below if/else - any check on this will be suffice.
          if (this.hasDescription()) {
              if (!this.isBrilliant()) {
                  r.push('This is Cool');
              } else {
                  r.push('This is Brilliant');
              }
              if (!this.isBrilliant()) {
              r.push('More Cool content');
              }
          }
  }
  </code></pre>
  <p>I tried to set <code>isBrilliant(</code>) with a mock value of <code>true</code>, and expect that the value to be truthy <code>expect(component.isBrilliant()).toBeTruthy();</code></p>
  <p>I tried to set this in the spec file by:</p>
  <pre><code>const isBrilliant = true;
  component.isBrilliant = isBrilliant;
  </code></pre>
  <p>however the error I got here was that <code>Type 'true' is not assignable to type '() =&gt; boolean'.</code></p>
  <p>If any experienced jasmine dev can show me a quick way to get some coverage for this simple statement that would be appreciated. Thanks</p>
  <hr />
  <p><strong>UPDATE</strong>:</p>
  <p>I can get <code>isBrilliant()</code> to be true or false. I now need to check the array r to see if the correct string has been <code>.push</code> into it? any ideas?</p>