summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src/main')
-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
+
+
+});