diff options
author | Lorraine Welch <lb2391@att.com> | 2020-04-15 23:18:31 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-04-15 23:18:31 +0000 |
commit | d6c83ea37b206ebf37c3dbc7f8e7922bfba3e664 (patch) | |
tree | a266600f183d3838b0dcee38b1616b241b2ed00f /ecomp-sdk/epsdk-app-overlay/src | |
parent | d26a763144a5df4d5b23975cb099788659db9a57 (diff) | |
parent | bb7feb3ffa99f3cdbca1671af54491e6a8c21678 (diff) |
Merge "some test cases in role-functions service"
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src')
-rw-r--r-- | ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.service.spec.ts | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.service.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.service.spec.ts new file mode 100644 index 00000000..7dc3aa9f --- /dev/null +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.service.spec.ts @@ -0,0 +1,50 @@ + +import { TestBed} from '@angular/core/testing'; +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { HttpClientModule } from '@angular/common/http'; +import { AdminService } from '../admin.service'; +import 'rxjs/add/observable/of'; +import { Observable } from 'rxjs/Observable'; +import 'rxjs/add/operator/catch'; +import 'rxjs/add/observable/throw'; +import { RoleFunctionsService } from './role-functions.service'; + +describe('RoleFunctionsService', () => { + + let component:RoleFunctionsService; + let service:AdminService; + var stubData={"data":{"active":"data2"}} + + beforeEach(() =>{ + TestBed.configureTestingModule({ + imports:[HttpClientTestingModule], + providers: [HttpClientModule,RoleFunctionsService] + }) + component = TestBed.get(RoleFunctionsService); + service = TestBed.get(AdminService); + }); + + it('should be created', () => { + const component: RoleFunctionsService = TestBed.get(RoleFunctionsService); + expect(component).toBeTruthy(); + }); + + it('should test add method',()=>{ + component.add("data"); + }) + + it('should test update method',()=>{ + let spy=spyOn(service,'saveRoleFunction').and.returnValue(Observable.of('your object')); + component.update("data"); + expect(spy).toHaveBeenCalled(); + }) + + + it('should test delete method',()=>{ + let spy=spyOn(service,'deleteRoleFunction').and.returnValue(Observable.of('your object')); + component.delete("data"); + expect(spy).toHaveBeenCalled(); + }) + + +});
\ No newline at end of file |