diff options
author | Indrijeet kumar <indriku1@in.ibm.com> | 2020-04-16 01:14:09 +0530 |
---|---|---|
committer | Indrijeet kumar <indriku1@in.ibm.com> | 2020-04-16 01:14:21 +0530 |
commit | bb7feb3ffa99f3cdbca1671af54491e6a8c21678 (patch) | |
tree | 211e62b6895dcce5a248237bd00c61aeff60ae87 /ecomp-sdk | |
parent | a1adb32cbb0548b209ca36e6f177f4de0af4e5b6 (diff) |
some test cases in role-functions service
some test cases in role-functions service
Issue-ID: PORTAL-813
Change-Id: Icc75c53485e3be0e7dd954de0fb59f604715a294
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/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 |