1 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
3 import { FormFieldsComponent } from './form-fields.component';
4 import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
5 import { FormsModule } from '@angular/forms';
6 import { HttpClientTestingModule } from '@angular/common/http/testing';
7 import { MatDialogModule, MatSnackBarModule } from '@angular/material';
8 import { CommonModule } from '@angular/common';
10 describe('FormFieldsComponent', () => {
11 let component: FormFieldsComponent;
12 let fixture: ComponentFixture<FormFieldsComponent>;
14 beforeEach(async(() => {
15 TestBed.configureTestingModule({
16 schemas:[CUSTOM_ELEMENTS_SCHEMA],
17 declarations: [ FormFieldsComponent ],
18 imports:[FormsModule,HttpClientTestingModule,MatDialogModule,MatSnackBarModule]
24 fixture = TestBed.createComponent(FormFieldsComponent);
25 component = fixture.componentInstance;
26 fixture.detectChanges();
29 it('should create', () => {
30 expect(component).toBeTruthy();
33 it('should test isFirst method',()=>{
34 expect(component.isFirst(0)).toBe(true);
35 expect(component.isFirst(2)).toBe(false);
38 it('should test isLast method', () =>{
39 component.formFieldsListObj.length = 12;
40 expect(component.isLast(15)).toEqual(false);
43 it('should test ngDoCheck method',()=>{
44 component.sqlAsDefaultValue=true;
45 if(component.sqlAsDefaultValue==true){
46 expect(component.showDefaultSQLOption).toBe(false);
49 expect(component.showDefaultSQLOption).toBe(true);