Test case- performace-vm component 45/76345/1
authorArundathi Patil <arundpil@in.ibm.com>
Fri, 25 Jan 2019 10:06:56 +0000 (15:36 +0530)
committerIBM602-PC0F1E3C\Arundathi <arundpil@in.ibm.com>
Fri, 25 Jan 2019 10:07:33 +0000 (15:37 +0530)
Configured test bed. Wrote test cases to cover this component 100%

Issue-ID: USECASEUI-195
Change-Id: I4983f963969e62d8f3759b2c7ed595b3fbef3cb4
Signed-off-by: Arundathi Patil <arundpil@in.ibm.com>
usecaseui-portal/src/app/performance/performance-vm/performance-vm.component.spec.ts

index fd441da..b66b2ea 100644 (file)
@@ -1,4 +1,5 @@
 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
+import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
 
 import { PerformanceVmComponent } from './performance-vm.component';
 
@@ -8,7 +9,10 @@ describe('PerformanceVmComponent', () => {
 
   beforeEach(async(() => {
     TestBed.configureTestingModule({
-      declarations: [ PerformanceVmComponent ]
+      declarations: [ PerformanceVmComponent ],
+      imports: [ 
+        BrowserAnimationsModule
+      ]
     })
     .compileComponents();
   }));
@@ -22,4 +26,43 @@ describe('PerformanceVmComponent', () => {
   it('should create', () => {
     expect(component).toBeTruthy();
   });
+
+  it('should test performanceShow method to set proper values', () => {
+    component.performanceShow();
+    expect(component.state).toBe('show');
+    expect(component.state2).toBe('hide');
+    expect(component.state3).toBe('hide');
+    expect(component.graphicshow).toBe(false);
+    expect(component.detailshow).toBe(false);
+  });
+
+  it('should test graphicShow method to set proper values', () => {
+    component.graphicShow();
+    expect(component.state).toBe('hide');
+    expect(component.state2).toBe('show');
+    expect(component.state3).toBe('hide');
+    expect(component.graphicshow).toBe(true);
+    expect(component.detailshow).toBe(false);
+  });
+
+  it('should test detailShow method to set proper values', () => {
+    component.detailShow({id:1});
+    expect(component.state).toBe('hide');
+    expect(component.state2).toBe('hide');
+    expect(component.state3).toBe('show');
+    expect(component.graphicshow).toBe(true);
+    expect(component.detailshow).toBe(true);
+    expect(component.detailId).toBe(1);
+  });
+
+  it('should test choseSourceName method', () => {
+    component.choseSourceName('bbbb');
+    expect(component.sourceNameSelected).toBe('bbbb');
+  });
+
+  it('should test choseSourceName method', () => {
+    component.choseReportingEntityName('bbbb');
+    expect(component.ReportingEntityNameSelected).toBe('bbbb');
+  });
+
 });