title: TypeError: cannot read property 'id' of undefined - Angular 8 Testing
body: <p>I am getting TypeError: cannot read property 'id' of undefined when trying to perform unit test in my angular 8 application.</p>
  
  <p>Here is my template</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-html lang-html prettyprint-override"><code>&lt;h4&gt;{{student.id}}&lt;/h4&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Here is my component</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>import {Component, EventEmitter, Input, OnInit} from '@angular/core';
  import { Student } from '@app/app-types';
  
  @Component({
  ...... saved some typing
  })
  
  export class StudentComponent implements OnInit {
  @Input() student: Student;
  refreshForm: EventEmitter&lt;any&gt;;
  
  constructor(){}
  
  ngOnInit(){
    this.refreshForm = new EventEmitter();
    }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>and here is the unit test</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>import {async, ComponentFixture, TestBed } from '@angular/core/testing';
  import {StudentComponet} from './student-component';
  
  describe('StudentComponet', () =&gt; {
    let component: StudentComponent;
    let fixture: ComponentFixture&lt;StudentComponent&gt;;
    
    beforeEach(async(() =&gt; {
    TestBed.configureTestingModule({
      declarations: [StudentComponent]
    }).compileComponents();
    }));
    
    beforeEach(() =&gt; {
      fixture = TestBed.createComponent(StudentComponent);
      component = fixture.componentInstance;
      fixture.detectChanges();
    });
    
    it('should create', () =&gt; {
    expect(component).toBeTruthy();
    })
    
    });</code></pre>
  </div>
  </div>
  </p>