diff options
author | Indrijeet kumar <indriku1@in.ibm.com> | 2020-04-01 22:31:02 +0530 |
---|---|---|
committer | Indrijeet kumar <indriku1@in.ibm.com> | 2020-04-01 22:31:10 +0530 |
commit | 13027866754eeb10f4462dcc89d3fc76f51ea148 (patch) | |
tree | 8556a6b7bf0f9d36449d9ce1cedd6aad3114fed9 /ecomp-sdk | |
parent | 7d3ad2425c0a774179ddb522e741d977c3bcf992 (diff) |
test cases written in roles component
test cases written in roles component
Issue-ID: PORTAL-813
Change-Id: Ib8ca9b5b48538ef4d1fb6ca81bb83b8444198694
Signed-off-by: Indrijeet Kumar <indriku1@in.ibm.com>
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 | 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') + // }) }); |