diff options
author | Lorraine Welch <lb2391@att.com> | 2020-04-15 23:17:10 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-04-15 23:17:10 +0000 |
commit | 29a9f45aecd4add5474874c968f8c9c1d051fbcd (patch) | |
tree | f0307f1146d2a8c9ec21d211806bc6a337fd5cc1 /ecomp-sdk | |
parent | 1c37532d04b36d4a3a3d5e8f61887b27e6794907 (diff) | |
parent | 1b540197f3e848fb752193601d9b908944aeaaed (diff) |
Merge "some test cases written in new-role component"
Diffstat (limited to 'ecomp-sdk')
-rw-r--r-- | ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/new-role/new-role.component.spec.ts | 47 |
1 files changed, 40 insertions, 7 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 4b496f1b..8a30f2a3 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,9 +43,10 @@ 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 } from '@ng-bootstrap/ng-bootstrap'; +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'; describe('NewRoleComponent', () => { let component: NewRoleComponent; @@ -56,8 +57,21 @@ describe('NewRoleComponent', () => { TestBed.configureTestingModule({ providers: [NgbActiveModal], schemas: [CUSTOM_ELEMENTS_SCHEMA] , - declarations: [ NewRoleComponent ], - imports: [FormsModule, MatTableModule, HttpClientTestingModule] + declarations: [ + NewRoleComponent, + ConfirmationModalComponent + ], + imports: [ + FormsModule, + MatTableModule, + HttpClientTestingModule, + NgbModule.forRoot() + ] + }) + TestBed.overrideModule(BrowserDynamicTestingModule,{ + set:{ + entryComponents:[ConfirmationModalComponent] + } }) .compileComponents(); })); @@ -69,7 +83,26 @@ describe('NewRoleComponent', () => { fixture.detectChanges(); }); - // it('should create', () => { - // expect(component).toBeTruthy(); - // }); + it('should create', () => { + expect(component).toBeTruthy(); + }); + + it('should test toggleRoleFunction method',()=>{ + component.ociavailableRoleFunctions=1; + component.toggleRoleFunction("toggleRoleFunction") + }) + + 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.isRoleAlreadyExist("currentRoleName") + }) + + it('it should test openConfirmationModal method',()=>{ + component.openConfirmationModal("indrijeet","kumar"); + }) });
\ No newline at end of file |