summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk
diff options
context:
space:
mode:
authorIndrijeet kumar <indriku1@in.ibm.com>2020-04-14 00:29:35 +0530
committerIndrijeet Kumar <indriku1@in.ibm.com>2020-04-15 15:00:12 +0000
commitc1770f10e548b96faf6d34c6a9b9b54c535fd101 (patch)
treee4ce1958bcf0f1369d9766780dd17721c789698d /ecomp-sdk
parent1c37532d04b36d4a3a3d5e8f61887b27e6794907 (diff)
test cases written in usage component
test cases written in usage component Issue-ID: PORTAL-813 Change-Id: I892e96ba686f569c2c6db9a75131daa45af4967e Signed-off-by: Indrijeet Kumar <indriku1@in.ibm.com>
Diffstat (limited to 'ecomp-sdk')
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/usage/usage.component.spec.ts17
1 files changed, 16 insertions, 1 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/usage/usage.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/usage/usage.component.spec.ts
index 01f31669..f283855d 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/usage/usage.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/usage/usage.component.spec.ts
@@ -44,16 +44,23 @@ import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { UsageComponent } from './usage.component';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { AdminComponent } from '../admin.component';
+import 'rxjs/add/observable/of';
+import { Observable } from 'rxjs/Observable';
describe('UsageComponent', () => {
let component: UsageComponent;
let fixture: ComponentFixture<UsageComponent>;
+ let adminService:AdminComponent;
+ var stubData={
+ "data":'[{"data":"cachedRegions"}]'}
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ UsageComponent ],
schemas:[CUSTOM_ELEMENTS_SCHEMA],
- imports:[HttpClientTestingModule]
+ imports:[HttpClientTestingModule],
+ providers:[AdminComponent]
})
.compileComponents();
}));
@@ -62,9 +69,17 @@ describe('UsageComponent', () => {
fixture = TestBed.createComponent(UsageComponent);
component = fixture.componentInstance;
fixture.detectChanges();
+ adminService=TestBed.get(AdminComponent);
});
it('should create', () => {
expect(component).toBeTruthy();
});
+
+ it('should test ngOnInit method',()=>{
+ let spy=spyOn(component.adminService,'getUsageList').and.returnValue(Observable.of(stubData));
+ component.ngOnInit();
+ expect(spy).toHaveBeenCalled();
+ })
+
});