I have the following code,
** component.ts,
constructor(public cdr:ChangeDetectorRef, public fb:FormBuilder) {
this.buildForm();
}
buildForm(): void {
this.feedbackForm = this.fb.group({
suggestedAScore: ['', [Validators.pattern(/^[0-9]+$/),Validators.required, Validators.maxLength(5), Validators.minLength(5)]],
minScore: ['', [Validators.pattern(/^[0-9]+$/),Validators.required,Validators.minLength(1),Validators.maxLength(1)]],
maxScore: ['', [Validators.pattern(/^[0-9]+$/),Validators.required,Validators.minLength(1),Validators.maxLength(1)]]
});
this.feedbackForm.setValidators(this.minMaxValidator());
this.isFeedbackFormValid();
};
** spec.ts, (shallow render)
describe('FeedbackOptionsComponent', () => {
let shallow: Shallow<FeedbackOptionsComponent>;
beforeEach(() => {
shallow = new Shallow(FeedbackOptionsComponent, AnnualCompensationModule)
.provide(FormBuilder)
});
it('should create', () => {
expect(FeedbackOptionsComponent).toBeTruthy();
});
When I run the code I am getting the test case,I am getting the following error:
this.fb.group({ is not a function
I am new to unit test cases.Can anyone please suggest me help to resolve this.