summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay
diff options
context:
space:
mode:
authorIndrijeet kumar <indriku1@in.ibm.com>2020-04-01 20:50:05 +0530
committerIndrijeet kumar <indriku1@in.ibm.com>2020-04-01 20:50:14 +0530
commite3d10020fa178a7bca5446caaaa3d257c249cc1e (patch)
treead84f67793a69dfb1c85c88b7d15c90e7b8152d4 /ecomp-sdk/epsdk-app-overlay
parent7d3ad2425c0a774179ddb522e741d977c3bcf992 (diff)
test cases written in header component
test cases written in header component Issue-ID: PORTAL-813 Change-Id: I41c7e7c5a84c1ab534753e380a042cb0dccc54e0 Signed-off-by: Indrijeet Kumar <indriku1@in.ibm.com>
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay')
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/header/header.component.spec.ts31
1 files changed, 19 insertions, 12 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 ecfd694d..1253b2be 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
@@ -37,20 +37,21 @@
*
*
*/
-import { async, ComponentFixture, TestBed, inject } from '@angular/core/testing';
+import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { RouterTestingModule } from '@angular/router/testing';
import { TranslateModule } from '@ngx-translate/core';
+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';
import { Router } from '@angular/router';
-import { MockBackend, MockConnection } from '@angular/http/testing';
-//import { observable, Observable } from 'rxjs';
+
import 'rxjs/add/observable/of';
import { Observable } from 'rxjs/Observable';
-import { BaseRequestOptions, Http } from '@angular/http';
+
describe('HeaderComponent', () => {
let headerService:HeaderService;
@@ -66,15 +67,13 @@ describe('HeaderComponent', () => {
LayoutModule,
RouterTestingModule,
TranslateModule.forRoot(),
+ HttpClientModule,
HttpClientTestingModule
],
- providers:[CookieService,HeaderService,MockBackend, BaseRequestOptions, {
- provide: Http,
- useFactory: (backend: MockBackend, defaultOptions: BaseRequestOptions) => {
- return new Http(backend, defaultOptions);
- },
- deps: [MockBackend, BaseRequestOptions],
- }]
+ providers:[
+ CookieService,
+ HeaderService
+ ]
})
.compileComponents();
}));
@@ -92,6 +91,12 @@ describe('HeaderComponent', () => {
expect(component).toBeTruthy();
});
+ it('testing if condition in ngOnInit method',()=>{
+ component.cookieService.set('show_app_header','false');
+ component.ngOnInit();
+ expect(component.showHeader).toBe(false)
+ })
+
describe('should test ngOnInit',()=>{
it('should validate on ngOnInit',()=>{
let spy=spyOn(headerService, 'getTopMenuItems').and.returnValue(Observable.of('you object'));
@@ -113,4 +118,6 @@ describe('HeaderComponent', () => {
it('should test on onLoggedout method',()=>{
expect(localStorage.getItem('isLoggedin')).toBeFalsy
})
-}); \ No newline at end of file
+
+
+});