From b409726e58fd9a0232b713e0ca44d098454d35ea Mon Sep 17 00:00:00 2001 From: Indrijeet kumar Date: Wed, 26 Feb 2020 20:39:22 +0530 Subject: test cases written for admin service test cases written for admin service Issue-ID: PORTAL-813 Change-Id: I0bfb7072f3acaf9a97af0e26dd8cfbb73b5be900 Signed-off-by: Indrijeet Kumar --- .../src/app/pages/admin/admin.service.spec.ts | 129 +++++++++++++++++++-- 1 file changed, 119 insertions(+), 10 deletions(-) (limited to 'ecomp-sdk') 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); + }) + }) + }); -- cgit 1.2.3-korg