diff options
-rw-r--r-- | ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/header-tabs-component/header-tabs.component.spec.ts | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/header-tabs-component/header-tabs.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/header-tabs-component/header-tabs.component.spec.ts index da392424..d8166076 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/header-tabs-component/header-tabs.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/analytics/Report_List/header-tabs-component/header-tabs.component.spec.ts @@ -4,10 +4,12 @@ import { HeaderTabsComponent } from './header-tabs.component'; import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { HttpClientTestingModule } from '@angular/common/http/testing'; import { RouterTestingModule } from '@angular/router/testing'; +import { CommonModule } from '@angular/common'; describe('MainComponentComponent', () => { let component: HeaderTabsComponent; let fixture: ComponentFixture<HeaderTabsComponent>; + beforeEach(async(() => { TestBed.configureTestingModule({ @@ -22,9 +24,51 @@ describe('MainComponentComponent', () => { fixture = TestBed.createComponent(HeaderTabsComponent); component = fixture.componentInstance; fixture.detectChanges(); + }); it('should create', () => { expect(component).toBeTruthy(); }); + + + it('should test if condition in ngOnInit method',()=>{ + component.reportId = "" + component.reportMode="" + component.ngOnInit(); + expect(component.finalReportId).toEqual("-1"); + expect(component.repMode).toEqual("Create"); + expect(component.reportId).toEqual("-1"); + expect(component.reportMode).toEqual("Create"); + }); + + it('should test else condition in ngOnInit method',()=>{ + component.reportId="Indrijeet"; + component.reportMode="kumar"; + component.ngOnInit(); + expect(component.finalReportId).toEqual(component.reportId); + }); + + it('should test if condition in ngAfterViewInit method',()=>{ + component.reportId = ""; + component.reportMode=""; + component.ngAfterViewInit(); + expect(component.finalReportId).toEqual("-1"); + expect(component.repMode).toEqual("Create"); + expect(component.reportId).toEqual("-1"); + expect(component.reportMode).toEqual("Create"); + }); + + it('should test else condition in ngAfterViewInit method',()=>{ + component.reportId="indrijeet"; + component.reportMode="kumar"; + component.ngAfterViewInit(); + expect(component.finalReportId).toEqual(component.reportId) + expect(component.repMode).toEqual(component.reportMode) + }); + + it('should test ngDoCheck method',()=>{ + component.ngDoCheck(); + console.log(component.tabChanged); + }) }); |