diff options
-rw-r--r-- | ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/roles/roles.component.spec.ts | 38 |
1 files changed, 36 insertions, 2 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 8af2689a..dcd637fc 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 @@ -45,16 +45,34 @@ import { RolesComponent } from './roles.component'; import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { MatTableModule } from '@angular/material'; import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { UserService } from 'src/app/shared/services/user/user.service'; +import { Observable } from 'rxjs'; +import { NgbModule } from '@ng-bootstrap/ng-bootstrap'; +import { InformationModalComponent } from 'src/app/modals/information-modal/information-modal.component'; +import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing'; describe('RolesComponent', () => { let component: RolesComponent; let fixture: ComponentFixture<RolesComponent>; + let userService: UserService; beforeEach(async(() => { TestBed.configureTestingModule({ schemas: [CUSTOM_ELEMENTS_SCHEMA], - declarations: [ RolesComponent ], - imports:[MatTableModule,HttpClientTestingModule] + declarations: [ + RolesComponent, + InformationModalComponent, + ], + imports:[ + MatTableModule, + HttpClientTestingModule, + NgbModule.forRoot() + ] + }) + TestBed.overrideModule(BrowserDynamicTestingModule,{ + set:{ + entryComponents:[InformationModalComponent] + } }) .compileComponents(); })); @@ -63,9 +81,25 @@ describe('RolesComponent', () => { fixture = TestBed.createComponent(RolesComponent); component = fixture.componentInstance; fixture.detectChanges(); + userService=TestBed.get(UserService); }); it('should create', () => { expect(component).toBeTruthy(); }); + + it('should test subscribe inside ngOnInit method',()=>{ + let spy=spyOn(userService,'getFunctionalMenuStaticDetailSession').and.returnValue(Observable.of('your data')) + component.ngOnInit(); + expect(spy).toHaveBeenCalled(); + }) + + it('should test delRoleConfirmPopUp method',()=>{ + component.delRoleConfirmPopUp('dummyargument'); + + }) + + // it('should test openAdoleModaldNewR method',()=>{ + // component.openAdoleModaldNewR('dummydata2') + // }) }); |