1dab68ba16fcf536e1bd02200088b3faff59939d
[portal/sdk.git] /
1 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2
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';
9
10 describe('FormFieldsComponent', () => {
11   let component: FormFieldsComponent;
12   let fixture: ComponentFixture<FormFieldsComponent>;
13
14   beforeEach(async(() => {
15     TestBed.configureTestingModule({
16       schemas:[CUSTOM_ELEMENTS_SCHEMA],
17       declarations: [ FormFieldsComponent ],
18       imports:[FormsModule,HttpClientTestingModule,MatDialogModule,MatSnackBarModule]
19     })
20     .compileComponents();
21   }));
22
23   beforeEach(() => {
24     fixture = TestBed.createComponent(FormFieldsComponent);
25     component = fixture.componentInstance;
26     fixture.detectChanges();
27   });
28
29   it('should create', () => {
30     expect(component).toBeTruthy();
31   });
32
33   it('should test isFirst method',()=>{
34     expect(component.isFirst(0)).toBe(true);
35     expect(component.isFirst(2)).toBe(false);
36   });
37
38   it('should test isLast method', () =>{
39     component.formFieldsListObj.length = 12;
40     expect(component.isLast(15)).toEqual(false);
41   });
42
43   it('should test ngDoCheck method',()=>{
44     component.sqlAsDefaultValue=true;
45     if(component.sqlAsDefaultValue==true){
46       expect(component.showDefaultSQLOption).toBe(false);
47     }
48     else{
49       expect(component.showDefaultSQLOption).toBe(true);
50     }
51  });
52
53 });