diff options
author | Indrijeet kumar <indriku1@in.ibm.com> | 2020-02-26 20:39:22 +0530 |
---|---|---|
committer | Indrijeet kumar <indriku1@in.ibm.com> | 2020-02-26 20:39:34 +0530 |
commit | b409726e58fd9a0232b713e0ca44d098454d35ea (patch) | |
tree | 84016f87f6c96c0dd71b7e434a81ac6924c13cd0 /ecomp-sdk/epsdk-app-overlay | |
parent | 87a32735c109d3c3802d91708b43fa405c7e1ee8 (diff) |
test cases written for admin service
test cases written for admin service
Issue-ID: PORTAL-813
Change-Id: I0bfb7072f3acaf9a97af0e26dd8cfbb73b5be900
Signed-off-by: Indrijeet Kumar <indriku1@in.ibm.com>
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay')
-rw-r--r-- | ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/admin.service.spec.ts | 129 |
1 files changed, 119 insertions, 10 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/admin.service.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/admin.service.spec.ts index 4892e72a..44df520c 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/admin.service.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/admin.service.spec.ts @@ -1,22 +1,131 @@ import { TestBed, async } from '@angular/core/testing'; import { AdminService } from './admin.service'; import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { environment } from 'src/environments/environment'; +import { HttpClientModule } from '@angular/common/http'; describe('AdminService', () => { - beforeEach(() => - TestBed.configureTestingModule({ - imports: [HttpClientTestingModule] - })); - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [] - }) - .compileComponents(); - })); + let service:AdminService; + + beforeEach(() =>{ + TestBed.configureTestingModule({ + imports:[HttpClientTestingModule], + providers: [HttpClientModule,AdminService] + }) + service = TestBed.get(AdminService); + }); it('should be created', () => { const service: AdminService = TestBed.get(AdminService); expect(service).toBeTruthy(); }); + + it('should get getUserPagination', () => { + service.getRoleFunctionList().subscribe((resp) => { + expect(resp).toBe(environment.roleFunctionList); + }); + }) + + it('should test saveRoleFunction',()=>{ + service.saveRoleFunction("roleData").subscribe((resp)=>{ + expect(resp).toBe(environment.addRoleFunction); + }) + }) + + it('should test getUsageList',()=>{ + service.getUsageList().subscribe((resp) => { + expect(resp).toBe(environment.usageList); + }) + }) + + it('should test getCacheRegions',()=>{ + service.getCacheRegions().subscribe((resp) => { + expect(resp).toBe(environment.cachedRegions); + }) + }) + + it('should test getRole',()=>{ + service.getRole(1).subscribe((resp) => { + expect(resp).toBe(environment.cachedRegions); + }) + }) + + it('should test getRole',()=>{ + service.getRole(1).subscribe((resp) => { + expect(resp).toBe(environment.getRole); + }) + }) + + it('should test getFnMenuItems',()=>{ + service.getFnMenuItems().subscribe((resp) => { + expect(resp).toBe(environment.getFnMenuItems); + }) + }) + + it('should test updateFnMenuItem',()=>{ + let menuObj: any + service.updateFnMenuItem(menuObj).subscribe((resp) => { + expect(resp).toBe(environment.updateFnMenuItem); + }) + }) + + it('should test getFunctionCdList',()=>{ + service.getFunctionCdList().subscribe((resp) => { + expect(resp).toBe(environment.getFunctionCdList); + }) + }) + + + it('should test getParentData',()=>{ + service.getParentData().subscribe((resp) => { + expect(resp).toBe(environment.getParentList); + }) + }) + + it('should test deleteRole',()=>{ + let roleData: any + service.deleteRole(roleData).subscribe((resp) => { + expect(resp).toBe(environment.deleteRole); + }) + }) + + it('should test deleteRoleFunction',()=>{ + let roleData: any + service.deleteRoleFunction(roleData).subscribe((resp) => { + expect(resp).toBe(environment.deleteRoleFunction); + }) + }) + + it('should test removeRoleFunction',()=>{ + let roleFunc:any; + let roleId:any; + service.removeRoleFunction(roleFunc,roleId).subscribe((resp) => { + expect(resp).toBe(environment.removeRoleFunction+roleId); + }) + }) + + it('should test saveRole',()=>{ + let roleObj:any; + let roleId:any; + service.saveRole(roleObj,roleId).subscribe((resp) => { + expect(resp).toBe(environment.saveRole+roleId); + }) + }) + + it('should test deleteMenu',()=>{ + let fnMenuItem: any + service.deleteMenu(fnMenuItem).subscribe((resp) => { + expect(resp).toBe(environment.deleteMenu); + }) + }) + + + it('should test getCacheRegionDetails',()=>{ + let cacheName:any + service.getCacheRegionDetails(cacheName).subscribe((resp) => { + expect(resp).toBe(environment.getRegion); + }) + }) + }); |