title: How to use setValue and patchValue in testing angular 2 reactive forms
body: <p>I can't seem to get the correct dependencies in my spec file for testing a new form I've created. </p>
  
  <p>I have 2 passing tests but the 3rd comes to a hault when I use setValue or patchValue to setup my test form data.</p>
  
  <p>Karma in browser gives: <code>TypeError: Cannot read property 'patchValue' of undefined</code></p>
  
  <pre><code>import { TestBed, async } from '@angular/core/testing';
  import { Component, ViewChild } from '@angular/core';
  import { MyComponent } from './my.component';
  import { NgForm, ReactiveFormsModule, FormGroup, FormControl, FormArray } from '@angular/forms';
  
  
  describe('My component test: ', () =&gt; {
  
      beforeEach(() =&gt; {
          TestBed.configureTestingModule({
              declarations: [MyComponent],
              imports: [ReactiveFormsModule],
              providers: [] // which provider for setValue/patchValue?
          });
  
          let fixture = TestBed.createComponent(MyComponent);
          let myComponent = fixture.debugElement.componentInstance;
  
      });
  
  
      it('sending form values to the service onSubmit method', () =&gt; {
          // TypeError: Cannot read property 'patchValue' of undefined
          this.jobForm.patchValue({'title': 'a spec title'}); 
      });
  </code></pre>
  
  <p>The question is: How do I use setValue/patchValue to setup my form object for a test form submission?</p>