summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk
diff options
context:
space:
mode:
authorLorraine Welch <lb2391@att.com>2020-04-20 16:46:50 +0000
committerGerrit Code Review <gerrit@onap.org>2020-04-20 16:46:50 +0000
commitd9c58a74a9a791101e45ea01ee46feb827d2fa16 (patch)
tree8d740d654574dff12d681306cfee42e30f4d1403 /ecomp-sdk
parentc1102bf187d2af895fb19e550820bfa73565b227 (diff)
parentc1770f10e548b96faf6d34c6a9b9b54c535fd101 (diff)
Merge "test cases written in usage component"
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();
+ })
+
});