title: Why fixture.detectChanges() is required for a unit test [Jasmine/Karma]
body: <p>I'm learning Unit testing with Jasmine and Karma. My test case is passing but I do not understand one thing. Here's my typescript:</p>
  
  <pre><code>// array list of objects where each month will have one object i.e. 12 objects (Jan to Dec)
  monthsData: Array&lt;{
      monthName: string;
      monthYear: number;
      isInRange: boolean;
      isLowerEdge: boolean;
      isUpperEdge: boolean;
  }&gt;;
  
  rangeState: { edge1Exists: boolean; edge2Exists: boolean; edgeIndexes: Array&lt;number&gt; };
  
  initRangeState() {} &lt;---- method which should be called; Not important for this question
  </code></pre>
  
  <p>And here's my test case in spec file:</p>
  
  <pre><code>it('should re-initialize range state when reflection is triggered', () =&gt; {
      fixture.detectChanges(); &lt;--- why this is required ?
      const rangeState = { edge1Exists: true, edge2Exists: true, edgeIndexes: [] };
      const monthsData = {
          monthName: 'Jan',
          monthYear: 2020,
          isInRange: true,
          isLowerEdge: true,
          isUpperEdge: false
      };
      fixture.componentInstance.rangeState = rangeState;
      fixture.componentInstance.monthsData[0] = monthsData;
      ...
      expect(fixture.componentInstance.initRangeState).toHaveBeenCalled();
  });
  </code></pre>
  
  <p>I do not understand that when I passed dummy <code>rangeState</code> and <code>monthsData</code> already. Then why I need to run <code>fixture.detectChanges()</code> in first place. My test case is failing without calling that. Please tell me the reason behind it. I'm sure there is something that I don't know.
  Here's the screenshot when <code>fixture.detectChanges()</code> is removed:</p>
  
  <p><a href="https://i.stack.imgur.com/hQP5u.png" rel="noreferrer"><img src="https://i.stack.imgur.com/hQP5u.png" alt="enter image description here"></a></p>