title: How do you unit test if statements in angular
body: <p>I have a function that subscribes a response from the NGRX store then uses the variable provided to change a message.</p>
  
  <p>How do I test that the message changes when the variable updates?</p>
  
  <pre><code>  getData() {
      this.service.getPreferences().subscribe(res =&gt; {
        this.mypreference$ = res.mypreference;
      });
      if (this.mypreference$ == false) {
        (this.mypreferenceType = 'noPreference');
      } else {
        (this.mypreferenceType = 'Preference');
      }
    }
  
  getPreferences() { return this.store.select('user').map((state: User) =&gt; state); }
  </code></pre>