diff options
author | Lorraine Welch <lb2391@att.com> | 2020-04-27 00:10:45 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-04-27 00:10:45 +0000 |
commit | db6c63ebfcce75b364ac46fbf66d800aab2fa652 (patch) | |
tree | 214082b55b0c04b04bb269ae0ce6e345a1483a4d /ecomp-sdk | |
parent | 977e26f9697ad01bae3d354bf7c60279fd034aa0 (diff) | |
parent | 8eb408473239da3053a0223206110ffd049c49c7 (diff) |
Merge "some test cases in roles component"
Diffstat (limited to 'ecomp-sdk')
-rw-r--r-- | ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/roles.component.spec.ts | 40 |
1 files changed, 29 insertions, 11 deletions
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 92d96135..11daaf84 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 @@ -51,11 +51,18 @@ 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'; +import { DataSource } from '@angular/cdk/table'; +import { AdminService } from '../admin.service'; +import { FormsModule } from '@angular/forms'; +import { HttpClientModule } from '@angular/common/http'; +import { HttpModule } from '@angular/http'; describe('RolesComponent', () => { let component: RolesComponent; let fixture: ComponentFixture<RolesComponent>; let userService: UserService; + let adminService:AdminService; + // var stubData={"result":{"data":'{"data"}',"role":'{"role"}'}}; beforeEach(async(() => { TestBed.configureTestingModule({ @@ -63,16 +70,26 @@ describe('RolesComponent', () => { declarations: [ RolesComponent, InformationModalComponent, + NewRoleComponent + ], + providers:[ + UserService, + DataSource, + AdminService, + HttpClientModule ], imports:[ MatTableModule, + FormsModule, + HttpModule, + HttpClientModule, HttpClientTestingModule, - NgbModule.forRoot() + NgbModule.forRoot(), ] }) TestBed.overrideModule(BrowserDynamicTestingModule,{ set:{ - entryComponents:[InformationModalComponent] + entryComponents:[InformationModalComponent, NewRoleComponent] } }) .compileComponents(); @@ -83,6 +100,7 @@ describe('RolesComponent', () => { component = fixture.componentInstance; fixture.detectChanges(); userService=TestBed.get(UserService); + adminService=TestBed.get(AdminService); }); it('should create', () => { @@ -95,15 +113,15 @@ describe('RolesComponent', () => { expect(spy).toHaveBeenCalled(); }) + it('should test getRole method',()=>{ + component.getRole("value"); + }) + it('should test delRoleConfirmPopUp method',()=>{ component.delRoleConfirmPopUp('dummyargument'); }) - // it('should test openAdoleModaldNewR method',()=>{ - // component.openAdoleModaldNewR('dummydata2') - // }) - it('should test openAdoleModaldNewR method',()=>{ component.toggleRole("") }) @@ -114,9 +132,9 @@ describe('RolesComponent', () => { component['getDismissReason'](""); }) - // it('should test applyFilter method',()=>{ - // component.applyFilter("filterValue T"); - // expect(component.dataSource.filter).toEqual("filtervalue"); - // }) - +it('should test openAddNewRoleModal method',()=>{ + component.openAddNewRoleModal("openAddNewRoleModal"); + component.openAddNewRoleModal('undefined'); +}) + }); |