summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.spec.ts
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.spec.ts')
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.spec.ts92
1 files changed, 8 insertions, 84 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.spec.ts
index d03cf4a6..4b496f1b 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.spec.ts
@@ -43,46 +43,21 @@ import {FormsModule} from '@angular/forms';
import { NewRoleComponent } from './new-role.component';
import { MatTableModule } from '@angular/material'
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
+import { HttpClient, HttpClientModule } from '@angular/common/http';
import { HttpClientTestingModule } from '@angular/common/http/testing';
-import { NgbActiveModal, NgbModule } from '@ng-bootstrap/ng-bootstrap';
-import { ConfirmationModalComponent } from 'src/app/modals/confirmation-modal/confirmation-modal.component';
-import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
-import { AdminService } from '../../admin.service';
-import { Observable } from 'rxjs';
-import { InformationModalComponent } from 'src/app/modals/information-modal/information-modal.component';
+import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
describe('NewRoleComponent', () => {
let component: NewRoleComponent;
let fixture: ComponentFixture<NewRoleComponent>;
let role1 = "";
- let adminService:AdminService;
- var _element={
- "selected":false,
- "code":"code",
- "type":"type",
- "action":"action"
- };
beforeEach(async(() => {
TestBed.configureTestingModule({
- providers: [NgbActiveModal,AdminService],
+ providers: [NgbActiveModal],
schemas: [CUSTOM_ELEMENTS_SCHEMA] ,
- declarations: [
- NewRoleComponent,
- ConfirmationModalComponent,
- InformationModalComponent
- ],
- imports: [
- FormsModule,
- MatTableModule,
- HttpClientTestingModule,
- NgbModule.forRoot()
- ]
- })
- TestBed.overrideModule(BrowserDynamicTestingModule,{
- set:{
- entryComponents:[ConfirmationModalComponent,InformationModalComponent]
- }
+ declarations: [ NewRoleComponent ],
+ imports: [FormsModule, MatTableModule, HttpClientTestingModule]
})
.compileComponents();
}));
@@ -92,60 +67,9 @@ describe('NewRoleComponent', () => {
component = fixture.componentInstance;
component.role = role1;
fixture.detectChanges();
- adminService=TestBed.get(AdminService);
- });
-
- it('should create', () => {
- expect(component).toBeTruthy();
});
- // it('should test ngOnInit method',()=>{
- // component.isEditMode=true;
- // component.ociavailableRoleFunctions="tndrijeet";
- // //component.ociavailableRoleFunctions.length=9;
- // component.ngOnInit();
- // })
-
- // it('should test setSelectedRoleFucntions method',()=>{
- // component.ociavailableRoleFunctions.length={"selected":false};
- // component.setSelectedRoleFucntions("i");
- // })
-
- it('should test delRoleFunctionConfirmPopUp method',()=>{
- component.delRoleFunctionConfirmPopUp("indrijeet","kumar");
- })
-
- // it('should test if condition in saveChanges method',()=>{
- // component.isEditMode=true;
- // //spyOn(adminService,'saveRole').and.returnValue(Observable.of('your object'));
- // component.saveChanges()
- // })
-
- it('should test else condition in saveChanges method',()=>{
- spyOn(adminService,'saveRole').and.returnValue(Observable.of('your object'));
- component.saveChanges()
- })
-
- it('should test toggleRoleFunction method',()=>{
- component.finalSelectedRoleFunctions="Indrijeet kumar";
- component.ociavailableRoleFunctions="i";
- component.finalSelectedRoleFunctions="k";
- component.toggleRoleFunction(_element)
- })
-
- it('should test populateTableData method',()=>{
- component.populateTableData("populateTableData");
- expect(component.roleFunctionDataSource.sort).toEqual(component.sort);
- expect(component.roleFunctionDataSource.paginator).toEqual(component.paginator)
- })
-
- it('should test isRoleAlreadyExist method',()=>{
- // component.availableRoles={"name":"currentRoleName"};
- component.availableRoles={"name":["currentRoleName"]};
- component.isRoleAlreadyExist("currentRoleName")
- })
-
- it('it should test openConfirmationModal method',()=>{
- component.openConfirmationModal("indrijeet","kumar");
- })
+ // it('should create', () => {
+ // expect(component).toBeTruthy();
+ // });
}); \ No newline at end of file