diff options
author | Lorraine Welch <lb2391@att.com> | 2020-03-05 15:45:52 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-03-05 15:45:52 +0000 |
commit | fc6b4e307a04b5d52c8fa7b3111c9834cd89e696 (patch) | |
tree | fcb41e6a85439b7469a49fadc525df3b12fca011 | |
parent | 245b7973bef22c58f2ff001b34e3215252aa579c (diff) | |
parent | e212c74f27f4b540f67e60f8091e93e769ac9229 (diff) |
Merge "test cases written in header-tabs component"
-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); + }) }); |