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: 1dab68ba16fcf536e1bd02200088b3faff59939d (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
import { async, ComponentFixture, TestBed } from '@angular/core/testing';

import { FormFieldsComponent } from './form-fields.component';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { FormsModule } from '@angular/forms';
import { HttpClientTestingModule } from '@angular/common/http/testing';
import { MatDialogModule, MatSnackBarModule } from '@angular/material';
import { CommonModule } from '@angular/common';

describe('FormFieldsComponent', () => {
  let component: FormFieldsComponent;
  let fixture: ComponentFixture<FormFieldsComponent>;

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      schemas:[CUSTOM_ELEMENTS_SCHEMA],
      declarations: [ FormFieldsComponent ],
      imports:[FormsModule,HttpClientTestingModule,MatDialogModule,MatSnackBarModule]
    })
    .compileComponents();
  }));

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

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

  it('should test isFirst method',()=>{
    expect(component.isFirst(0)).toBe(true);
    expect(component.isFirst(2)).toBe(false);
  });

  it('should test isLast method', () =>{
    component.formFieldsListObj.length = 12;
    expect(component.isLast(15)).toEqual(false);
  });

  it('should test ngDoCheck method',()=>{
    component.sqlAsDefaultValue=true;
    if(component.sqlAsDefaultValue==true){
      expect(component.showDefaultSQLOption).toBe(false);
    }
    else{
      expect(component.showDefaultSQLOption).toBe(true);
    }
 });

});