f491f3724d4e82754d1098579842f6e5f3c6a854
[portal/sdk.git] /
1 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
2
3 import { FormFieldsComponent } from './form-fields.component';
4
5 describe('FormFieldsComponent', () => {
6   let component: FormFieldsComponent;    
7   let fixture: ComponentFixture<FormFieldsComponent>;
8                                      
9   beforeEach(async(() => {
10     TestBed.configureTestingModule({    
11       declarations: [ FormFieldsComponent ]
12     })
13     .compileComponents();
14   }));
15
16   beforeEach(() => {
17     fixture = TestBed.createComponent(FormFieldsComponent);
18     component = fixture.componentInstance;
19     fixture.detectChanges();
20   }); 
21
22   it('should create', () => {
23     expect(component).toBeTruthy();
24   });
25
26   it('should test ngOnInit function', () => {
27     component.ngOnInit();
28   });
29
30   it('should test isLast functions', () =>{
31     component.formFieldsListObj = [1,2,3,4,5];
32     let test: Boolean =  component.isLast(3);
33     expect(test).toEqual(false);
34   });
35
36   it('should test isFirst function', () => {
37     let test: Boolean = component.isFirst(0);
38     expect(test).toEqual(true);
39   });
40
41   it('should test ngDoCheck', () => {
42     component.sqlAsDefaultValue = true;
43     component.ngDoCheck();
44     expect(component.showDefaultSQLOption).toEqual(true);    
45   });
46
47   it('should test close function', () => {
48     component.close();
49     expect(component.closable).toEqual(false);
50   });
51
52   it('should test closeValidateModal', () => {
53     component.closeValidateModal();
54     expect(component.showSpinner).toEqual(false);
55   });
56
57   it('should test openDialog method', () => {
58     expect(component.openDialog).toHaveBeenCalled();
59   });
60
61   it('should test openSnackBar method', () => {
62     component.openSnackBar("Just", "for testing");
63     expect(component.openSnackBar).toHaveBeenCalled();
64   })
65
66 });