diff options
author | Indrijeet kumar <indriku1@in.ibm.com> | 2020-02-24 13:18:36 +0530 |
---|---|---|
committer | Indrijeet kumar <indriku1@in.ibm.com> | 2020-02-24 13:18:49 +0530 |
commit | 142ab2f44aae317a05de60908c0b259c73b79f6e (patch) | |
tree | e464f5c7f943dec4d91adcae922e2709ef2f06e2 /ecomp-sdk | |
parent | f2bd6fd5f2d9530a68b4966164e491a861e7ff90 (diff) |
test case written in header component
test case written in header component
Issue-ID: PORTAL-813
Change-Id: I306a41b6a76f6d72cef1a921d99254963551d9e8
Signed-off-by: Indrijeet Kumar <indriku1@in.ibm.com>
Diffstat (limited to 'ecomp-sdk')
-rw-r--r-- | ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.spec.ts | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.spec.ts index 7418893a..4a12cd9f 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.spec.ts @@ -4,7 +4,9 @@ * =================================================================== * Copyright © 2019 AT&T Intellectual Property. All rights reserved. * =================================================================== - * + * Modification Copyright © 2020 IBM. + * =================================================================== + * * Unless otherwise specified, all software contained herein is licensed * under the Apache License, Version 2.0 (the "License"); * you may not use this software except in compliance with the License. @@ -43,8 +45,11 @@ import { HttpClientModule } from '@angular/common/http'; import { HeaderComponent } from './header.component'; import { LayoutModule } from '../../layout.module'; import { CookieService } from 'ngx-cookie-service'; +import { HeaderService } from 'src/app/shared/services/header/header.service'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; describe('HeaderComponent', () => { + let headerService:HeaderService; let component: HeaderComponent; let fixture: ComponentFixture<HeaderComponent>; @@ -56,6 +61,7 @@ describe('HeaderComponent', () => { RouterTestingModule, TranslateModule.forRoot(), HttpClientModule, + HttpClientTestingModule ], }) .compileComponents(); @@ -65,11 +71,28 @@ describe('HeaderComponent', () => { fixture = TestBed.createComponent(HeaderComponent); component = fixture.componentInstance; fixture.detectChanges(); + headerService = TestBed.get(HeaderService); }); it('should create', () => { expect(component).toBeTruthy(); }); - + it('should test ngOnInit method',()=>{ + fixture.detectChanges(); + component.ngOnInit(); + if(component.cookieService.get('show_app_header')=='false') + expect(component.showHeader).toBe(false); + expect(component.pushRightClass).toEqual('push-right'); + (done: DoneFn)=> { + headerService.getTopMenuItems().subscribe(res=>{ + expect(component.response).toEqual(res); + expect(component.userFirstName).toBe(component.response.firstName); + expect(component.userEmail).toBe(component.response.email); + expect(component.userId).toBe(component.response.userId); + expect(component.userName).toBe(component.response.userName); + done(); + }) + } + }); }); |