summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/Report/form-fields/form-fields.component.spec.ts
blob: f491f3724d4e82754d1098579842f6e5f3c6a854 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { FormFieldsComponent } from './form-fields.component';

describe('FormFieldsComponent', () => {
  let component: FormFieldsComponent;    
  let fixture: ComponentFixture<FormFieldsComponent>;
                                     
  beforeEach(async(() => {
    TestBed.configureTestingModule({    
      declarations: [ FormFieldsComponent ]
    })
    .compileComponents();
  }));

  beforeEach(() => {
    fixture = TestBed.createComponent(FormFieldsComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  }); 

  it('should create', () => {
    expect(component).toBeTruthy();
  });

  it('should test ngOnInit function', () => {
    component.ngOnInit();
  });

  it('should test isLast functions', () =>{
    component.formFieldsListObj = [1,2,3,4,5];
    let test: Boolean =  component.isLast(3);
    expect(test).toEqual(false);
  });

  it('should test isFirst function', () => {
    let test: Boolean = component.isFirst(0);
    expect(test).toEqual(true);
  });

  it('should test ngDoCheck', () => {
    component.sqlAsDefaultValue = true;
    component.ngDoCheck();
    expect(component.showDefaultSQLOption).toEqual(true);    
  });

  it('should test close function', () => {
    component.close();
    expect(component.closable).toEqual(false);
  });

  it('should test closeValidateModal', () => {
    component.closeValidateModal();
    expect(component.showSpinner).toEqual(false);
  });

  it('should test openDialog method', () => {
    expect(component.openDialog).toHaveBeenCalled();
  });

  it('should test openSnackBar method', () => {
    component.openSnackBar("Just", "for testing");
    expect(component.openSnackBar).toHaveBeenCalled();
  })

});