1 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
3 import { FormFieldsComponent } from './form-fields.component';
5 describe('FormFieldsComponent', () => {
6 let component: FormFieldsComponent;
7 let fixture: ComponentFixture<FormFieldsComponent>;
9 beforeEach(async(() => {
10 TestBed.configureTestingModule({
11 declarations: [ FormFieldsComponent ]
17 fixture = TestBed.createComponent(FormFieldsComponent);
18 component = fixture.componentInstance;
19 fixture.detectChanges();
22 it('should create', () => {
23 expect(component).toBeTruthy();
26 it('should test ngOnInit function', () => {
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);
36 it('should test isFirst function', () => {
37 let test: Boolean = component.isFirst(0);
38 expect(test).toEqual(true);
41 it('should test ngDoCheck', () => {
42 component.sqlAsDefaultValue = true;
43 component.ngDoCheck();
44 expect(component.showDefaultSQLOption).toEqual(true);
47 it('should test close function', () => {
49 expect(component.closable).toEqual(false);
52 it('should test closeValidateModal', () => {
53 component.closeValidateModal();
54 expect(component.showSpinner).toEqual(false);
57 it('should test openDialog method', () => {
58 expect(component.openDialog).toHaveBeenCalled();
61 it('should test openSnackBar method', () => {
62 component.openSnackBar("Just", "for testing");
63 expect(component.openSnackBar).toHaveBeenCalled();