From 7e62a2b29498552a31fa1e244f1cfb94fe642364 Mon Sep 17 00:00:00 2001 From: Indrijeet kumar Date: Thu, 16 Apr 2020 01:20:16 +0530 Subject: test cases written in new-role-function comp test cases written in new-role-function component Issue-ID: PORTAL-813 Change-Id: I69065920266a3a2be1d22c0dfe8a4848fa03e256 Signed-off-by: Indrijeet Kumar --- .../new-role-function.component.spec.ts | 46 +++++++++++++++++++--- 1 file changed, 40 insertions(+), 6 deletions(-) diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/new-role-function/new-role-function.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/new-role-function/new-role-function.component.spec.ts index ecc0947d..7ef63baf 100644 --- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/new-role-function/new-role-function.component.spec.ts +++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/role-functions/new-role-function/new-role-function.component.spec.ts @@ -4,6 +4,8 @@ * =================================================================== * Copyright (C) 2019 AT&T Intellectual Property. All rights reserved. * =================================================================== + * Modification Copyright © 2020 IBM. + * =================================================================== * * Unless otherwise specified, all software contained herein is licensed * under the Apache License, Version 2.0 (the "License"); @@ -41,7 +43,12 @@ import { NewRoleFunctionComponent } from './new-role-function.component'; import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { FormsModule } from '@angular/forms'; import { HttpClientTestingModule } from '@angular/common/http/testing'; -import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { NgbActiveModal, NgbModule } from '@ng-bootstrap/ng-bootstrap'; +import {MatRadioModule } from '@angular/material'; +import { RouterTestingModule } from '@angular/router/testing'; +import { ConfirmationModalComponent } from 'src/app/modals/confirmation-modal/confirmation-modal.component'; +import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing'; +import { InformationModalComponent } from 'src/app/modals/information-modal/information-modal.component'; describe('NewRoleFunctionComponent', () => { let component: NewRoleFunctionComponent; @@ -50,10 +57,25 @@ describe('NewRoleFunctionComponent', () => { beforeEach(async(() => { TestBed.configureTestingModule({ schemas:[CUSTOM_ELEMENTS_SCHEMA], - declarations: [ NewRoleFunctionComponent ], - imports:[FormsModule,HttpClientTestingModule], + declarations: [ + NewRoleFunctionComponent, + ConfirmationModalComponent, + InformationModalComponent + ], + imports:[ + FormsModule, + HttpClientTestingModule, + MatRadioModule, + RouterTestingModule, + NgbModule.forRoot() + ], providers:[NgbActiveModal] }) + TestBed.overrideModule(BrowserDynamicTestingModule,{ + set:{ + entryComponents:[ConfirmationModalComponent,InformationModalComponent] + } + }) .compileComponents(); })); @@ -63,7 +85,19 @@ describe('NewRoleFunctionComponent', () => { fixture.detectChanges(); }); - // it('should create', () => { - // expect(component).toBeTruthy(); - // }); + it('should create', () => { + expect(component).toBeTruthy(); + }); + + it('should test ngOnInit method',()=>{ + component.ngOnInit(); + }) + + it('should test saveRoleFunction method',()=>{ + component.saveRoleFunction(); + }) + + it('should test openConfirmationModal method',()=>{ + component.openConfirmationModal("indrijeet","kumar") + }) }); -- cgit 1.2.3-korg