From bfa671e18c1a83b91af6d56834704260716d0126 Mon Sep 17 00:00:00 2001 From: Indrijeet kumar Date: Fri, 17 Apr 2020 06:45:13 +0530 Subject: some commits in self roles & role-functions some commits in self roles & role-functions Issue-ID: PORTAL-813 Change-Id: I816845d40e3a6af3cc1f8167117489b22d0fbe39 Signed-off-by: Indrijeet Kumar --- .../role-functions/role-functions.service.spec.ts | 14 +++++++++++++- .../src/app/pages/admin/roles/roles.component.spec.ts | 19 ++++++++++++++++++- .../app/pages/ext/profile/self/self.component.spec.ts | 7 +++++++ 3 files changed, 38 insertions(+), 2 deletions(-) (limited to 'ecomp-sdk') 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 index 7dc3aa9f..0e59f9eb 100644 --- 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 @@ -13,7 +13,8 @@ describe('RoleFunctionsService', () => { let component:RoleFunctionsService; let service:AdminService; - var stubData={"data":{"active":"data2"}} + //var stubData=['{"data":'{"active":"data2"}'}'] + //var stubData1='{stubData}' beforeEach(() =>{ TestBed.configureTestingModule({ @@ -39,6 +40,12 @@ describe('RoleFunctionsService', () => { expect(spy).toHaveBeenCalled(); }) + it('should test error part of update method',()=>{ + let spy=spyOn(service,'saveRoleFunction').and.returnValue(Observable.throw({status:404})); + component.update("data"); + expect(spy).toHaveBeenCalled(); +}) + it('should test delete method',()=>{ let spy=spyOn(service,'deleteRoleFunction').and.returnValue(Observable.of('your object')); @@ -46,5 +53,10 @@ describe('RoleFunctionsService', () => { expect(spy).toHaveBeenCalled(); }) + it('should test get method',()=>{ + let spy=spyOn(service,'getRoleFunctionList').and.returnValue(Observable.of()) + component.get(); + expect(spy).toHaveBeenCalled(); + }) }); \ No newline at end of file diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/roles.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/roles.component.spec.ts index dcd637fc..92d96135 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/roles.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/roles.component.spec.ts @@ -47,9 +47,10 @@ import { MatTableModule } from '@angular/material'; import { HttpClientTestingModule } from '@angular/common/http/testing'; import { UserService } from 'src/app/shared/services/user/user.service'; import { Observable } from 'rxjs'; -import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; +import { NgbModule, ModalDismissReasons } from '@ng-bootstrap/ng-bootstrap'; import { InformationModalComponent } from 'src/app/modals/information-modal/information-modal.component'; import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing'; +import { NewRoleComponent } from './new-role/new-role.component'; describe('RolesComponent', () => { let component: RolesComponent; @@ -102,4 +103,20 @@ describe('RolesComponent', () => { // it('should test openAdoleModaldNewR method',()=>{ // component.openAdoleModaldNewR('dummydata2') // }) + + it('should test openAdoleModaldNewR method',()=>{ + component.toggleRole("") + }) + + it('should test getDismissReason method',()=>{ + component['getDismissReason'](ModalDismissReasons.ESC); + component['getDismissReason'](ModalDismissReasons.BACKDROP_CLICK); + component['getDismissReason'](""); + }) + + // it('should test applyFilter method',()=>{ + // component.applyFilter("filterValue T"); + // expect(component.dataSource.filter).toEqual("filtervalue"); + // }) + }); diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.spec.ts index 97e164df..ee8f7b64 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.spec.ts @@ -50,6 +50,7 @@ import { UserService } from 'src/app/shared/services/user/user.service'; import { Observable } from 'rxjs'; import { ActivatedRoute } from '@angular/router'; import { RouterTestingModule } from '@angular/router/testing'; +import { ModalDismissReasons } from '@ng-bootstrap/ng-bootstrap'; describe('SelfComponent', () => { let component: SelfComponent; @@ -94,4 +95,10 @@ describe('SelfComponent', () => { }) }) + it('should test getDismissReason method',()=>{ + component['getDismissReason'](ModalDismissReasons.ESC); + component['getDismissReason'](ModalDismissReasons.BACKDROP_CLICK); + component['getDismissReason'](""); + }) + }); -- cgit 1.2.3-korg