From: Indrijeet kumar Date: Wed, 1 Apr 2020 15:28:48 +0000 (+0530) Subject: test cases written in layout component X-Git-Tag: 3.3.0~162^2 X-Git-Url: https://gerrit.onap.org/r/gitweb?a=commitdiff_plain;h=refs%2Fchanges%2F86%2F104886%2F1;p=portal%2Fsdk.git test cases written in layout component test cases written in layout component Issue-ID: PORTAL-813 Change-Id: I7213b756e6b3f9628a842030e1ff1ef800068e5d Signed-off-by: Indrijeet Kumar --- diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/layout.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/layout.component.spec.ts index 6a2bb7ff..975f72c3 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/layout.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/layout.component.spec.ts @@ -41,17 +41,17 @@ import { TranslateModule } from '@ngx-translate/core'; import { HttpClientTestingModule } from '@angular/common/http/testing'; import { LayoutComponent } from './layout.component'; import { LayoutModule } from './layout.module'; -import { MatDialog, MatDialogModule } from '@angular/material'; -import { Overlay } from '@angular/cdk/overlay'; +import { MatDialogModule } from '@angular/material'; import { CookieService } from 'ngx-cookie-service'; +import { MockBackend } from '@angular/http/testing'; describe('LayoutComponent', () => { let component: LayoutComponent; let fixture: ComponentFixture; + let cookieService: CookieService; beforeEach( async(() => { TestBed.configureTestingModule({ - providers:[CookieService], imports: [ MatDialogModule, HttpClientTestingModule, @@ -59,6 +59,10 @@ describe('LayoutComponent', () => { RouterTestingModule, TranslateModule.forRoot(), ], + providers:[ + CookieService, + MockBackend + ] }).compileComponents(); }) ); @@ -67,15 +71,22 @@ describe('LayoutComponent', () => { fixture = TestBed.createComponent(LayoutComponent); component = fixture.componentInstance; fixture.detectChanges(); + cookieService = TestBed.get(CookieService); }); it('should create', () => { expect(component).toBeTruthy(); }); + it('testing if condition in ngOnInit method',()=>{ + component.cookieService.set('show_app_header','false'); + component.ngOnInit(); + expect(component.showHeader).toBe(false) + }) + it('should test receiveCollapsed method',()=>{ component.receiveCollapsed(true); expect(component.collapedSideBar).toBe(true); }) -}); +}); \ No newline at end of file