diff options
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'); +}) + }); |