some commits in self roles & role-functions 71/106171/1
authorIndrijeet kumar <indriku1@in.ibm.com>
Fri, 17 Apr 2020 01:15:13 +0000 (06:45 +0530)
committerIndrijeet kumar <indriku1@in.ibm.com>
Fri, 17 Apr 2020 01:15:20 +0000 (06:45 +0530)
some commits in self roles & role-functions

Issue-ID: PORTAL-813
Change-Id: I816845d40e3a6af3cc1f8167117489b22d0fbe39
Signed-off-by: Indrijeet Kumar <indriku1@in.ibm.com>
ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/role-functions.service.spec.ts
ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/roles.component.spec.ts
ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/ext/profile/self/self.component.spec.ts

index 7dc3aa9..0e59f9e 100644 (file)
@@ -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
index dcd637f..92d9613 100644 (file)
@@ -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");
+  // })
+  
 });
index 97e164d..ee8f7b6 100644 (file)
@@ -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']("");
+  })
+
 });