diff options
author | Lorraine Welch <lb2391@att.com> | 2020-02-26 17:32:53 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-02-26 17:32:53 +0000 |
commit | 233d0688167439ec1ef9099b7acec8308489b8c0 (patch) | |
tree | bdd0291dc9b3f50988964ce95541451a56e727c5 | |
parent | 0e0d81ca965494d18820ede7747a680334c7c955 (diff) | |
parent | b409726e58fd9a0232b713e0ca44d098454d35ea (diff) |
Merge "test cases written for admin service"
-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); + }) + }) + }); |