From 4d1ac762a89617d59867661df153c4d40a59e8cc Mon Sep 17 00:00:00 2001 From: Indrijeet kumar Date: Mon, 27 Apr 2020 03:03:28 +0530 Subject: some test cases in sidebar component some test cases in sidebar component Issue-ID: PORTAL-813 Change-Id: I3b3548e4727c889cac47c42ddf9dafe55c137c02 Signed-off-by: Indrijeet Kumar --- .../components/sidebar/sidebar.component.spec.ts | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.spec.ts index 7f5a43fe..42c176bf 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.spec.ts @@ -37,6 +37,7 @@ * * */ + import { async, ComponentFixture, TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { TranslateModule } from '@ngx-translate/core'; @@ -55,13 +56,15 @@ describe('SidebarComponent', () => { let sidebarService: SidebarService; var stubData1={ - "data":'{"data":"cachedRegions"}', - "data2":'{"data2":"cachedRegions2"}' + "data":'"d"', + "data2":'"data2"' }; - + var stubData2={ + "data":'"d"', + "data2":'" "' + }; beforeEach(async(() => { - let sidebarService: SidebarService; TestBed.configureTestingModule({ imports: [ LayoutModule, @@ -102,6 +105,14 @@ describe('SidebarComponent', () => { }) }) + //describe('should test ngOnInit if part',()=>{ + //it('should validate on ngOnInit',()=>{ + //let spy=spyOn(sidebarService,'getLeftMenu').and.returnValue(Observable.of(stubData2)); + // component.ngOnInit(); + //expect(spy).toHaveBeenCalled(); + //}) + //}) + it('should test addExpandClass if element and showMenu variable value are same', () => { component.showMenu= '1'; component.addExpandClass('1'); -- cgit 1.2.3-korg