sidebar component spec- added unit test cases 97/98997/1
authorArundathi Patil <arundpil@in.ibm.com>
Mon, 2 Dec 2019 09:26:28 +0000 (14:56 +0530)
committerArundathi Patil <arundpil@in.ibm.com>
Mon, 2 Dec 2019 09:44:56 +0000 (15:14 +0530)
Issue-ID: PORTAL-416
Change-Id: Ia6042763a5337e675241225ee0787686e8c9133a
Signed-off-by: Arundathi Patil <arundpil@in.ibm.com>
ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/layout/components/sidebar/sidebar.component.spec.ts

index 8dbcb61..6b53cae 100644 (file)
@@ -3,6 +3,8 @@
  * ONAP Portal SDK
  * ===================================================================
  * Copyright © 2019 AT&T Intellectual Property. All rights reserved.
+ * 
+ * Modification Copyright © 2019 IBM.
  * ===================================================================
  *
  * Unless otherwise specified, all software contained herein is licensed
 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 { SidebarComponent } from './sidebar.component';
 import { LayoutModule } from '../../layout.module';
 
-describe('SidebarComponent', () => {
+fdescribe('SidebarComponent', () => {
   let component: SidebarComponent;
   let fixture: ComponentFixture<SidebarComponent>;
 
@@ -52,6 +55,7 @@ describe('SidebarComponent', () => {
         LayoutModule,
         RouterTestingModule,
         TranslateModule.forRoot(),
+        HttpClientModule
       ],
     })
     .compileComponents();
@@ -66,4 +70,33 @@ describe('SidebarComponent', () => {
   it('should create', () => {
     expect(component).toBeTruthy();
   });
+
+  it('should test addExpandClass if element and showMenu variable value are same', () => {
+    component.showMenu= '1';
+    component.addExpandClass('1');
+    expect(component.showMenu).toBe('0');
+  });
+
+  it('should test addExpandClass if element and showMenu variable value are not same', () => {
+    component.showMenu= '0';
+    component.addExpandClass('1');
+    expect(component.showMenu).toBe('1');
+  });
+
+  it('should test toggleCollapsed function', () => {
+    component.collapsed= true;
+    component.toggleCollapsed();
+    expect(component.collapsed).toBe(false);
+  });
+
+  it('should test eventCalled function', () => {
+    component.isActive= true;
+    component.eventCalled();
+    expect(component.isActive).toBe(false);
+  });
+
+  it('should test ngOnInit function', () => {   
+    component.ngOnInit();    
+  });
+
 });