diff options
author | Indrijeet kumar <indriku1@in.ibm.com> | 2020-04-27 02:33:57 +0530 |
---|---|---|
committer | Indrijeet Kumar <indriku1@in.ibm.com> | 2020-04-26 23:03:03 +0000 |
commit | 8eb408473239da3053a0223206110ffd049c49c7 (patch) | |
tree | 9eb21b3b60cb67d7975f9ba81d508d5a8fafd989 /ecomp-sdk/epsdk-app-overlay/src | |
parent | 8c193243356e909d0210036006aa9416c6455d00 (diff) |
some test cases in roles component
some test cases in roles component
Issue-ID: PORTAL-813
Change-Id: Id57c0e7b8de25ffd1a2bb99562877e53bbf688cf
Signed-off-by: Indrijeet Kumar <indriku1@in.ibm.com>
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src')
-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'); +}) + }); |