I have two question in regards to mocking Formbuilder in Angular2.
1) How do I mock formBuilder in a spec? Are there any given mocks that we can use? I would like to for instance, update the values of a form in my spec, and then test to see if the form is still valid - or test the functionality of methods in my component that update a formbuilder group, or determine if a formbuilder group is valid.
2) How do I deal with the following error given that fb is a DI injection of Formbuilder in a spec?
null is not an object (evaluating 'this.fb.group')
when the component is as follows:
export class LoginComponent implements OnInit {
constructor( private fb: FormBuilder ) {}
ngOnInit() {
this.loginForm = this.fb.group({
'email': this.user.email,
'password': this.user.password
});
}
}