summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLorraine Welch <lb2391@att.com>2020-04-01 16:32:17 +0000
committerGerrit Code Review <gerrit@onap.org>2020-04-01 16:32:17 +0000
commit63a54ac2067f0e30f40cf5b195a1de0b29da5ca8 (patch)
tree6dba2b54ae1edf6a53619d08af68be932e4d32fe
parentc6305069b5eb8bca8f947470bfaae9033b8f20eb (diff)
parent00c22d16c29c85aca48e9cce2ea2261339dadf7d (diff)
Merge "test cases written for new-menu component"
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/new-menu/new-menu.component.spec.ts141
1 files changed, 73 insertions, 68 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/new-menu/new-menu.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/new-menu/new-menu.component.spec.ts
index 7ddaf632..5c22346e 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/new-menu/new-menu.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/new-menu/new-menu.component.spec.ts
@@ -46,35 +46,42 @@ import { HttpClientTestingModule } from '@angular/common/http/testing';
import { NgbActiveModal, NgbModalModule } from '@ng-bootstrap/ng-bootstrap';
import { RouterTestingModule } from '@angular/router/testing';
import { CookieService } from 'ngx-cookie-service';
-import { MockBackend } from '@angular/http/testing';
-import { BaseRequestOptions, Http } from '@angular/http';
import { AdminService } from '../../admin.service';
import 'rxjs/add/operator/toPromise';
import { ConfirmationModalComponent } from 'src/app/modals/confirmation-modal/confirmation-modal.component';
import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
-import { MaterialModule } from 'portalsdk-tag-lib/material-module';
import 'rxjs/add/observable/of';
import { Observable } from 'rxjs/Observable';
+import 'rxjs/add/operator/catch';
+import 'rxjs/add/observable/throw';
+import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
describe('NewMenuComponent', () => {
let component: NewMenuComponent;
let fixture: ComponentFixture<NewMenuComponent>;
let adminService:AdminService;
- // let entryComponents:any;
beforeEach(async(() => {
TestBed.configureTestingModule({
- declarations: [ NewMenuComponent ],
- imports:[FormsModule, HttpClientTestingModule,RouterTestingModule,NgbModalModule,BrowserAnimationsModule],
- providers:[AdminService,NgbActiveModal,CookieService,MockBackend,BaseRequestOptions,{
- provide:Http,
- useFactory:(backend:MockBackend,defaultOptions:BaseRequestOptions)=>{
- return new Http(backend,defaultOptions);
- },
- deps:[MockBackend,BaseRequestOptions],
- entryComponents:[ConfirmationModalComponent]
- }],
+ declarations: [ NewMenuComponent,ConfirmationModalComponent ],
+ imports:[
+ FormsModule,
+ HttpClientTestingModule,
+ RouterTestingModule,
+ NgbModalModule,
+ BrowserAnimationsModule
+ ],
+ providers:[
+ AdminService,
+ NgbActiveModal,
+ CookieService
+ ],
+ })
+ TestBed.overrideModule(BrowserDynamicTestingModule,{
+ set:{
+ entryComponents:[ConfirmationModalComponent ]
+ }
})
.compileComponents();
@@ -87,57 +94,55 @@ describe('NewMenuComponent', () => {
adminService=TestBed.get(AdminService);
});
-// // it('should create', () => {
-// // expect(component).toBeTruthy();
-// // });
-
-// it('testing ngOnInit method for if condition',()=>{
-// component.selectedMenu=1;
-// component.ngOnInit();
-// expect(component.menu).toEqual(component.selectedMenu);
-// })
-
-// it('testing ngOnInit method for else condition',()=>{
-// component.selectedMenu=0;
-// component.ngOnInit();
-// expect(component.menu.menuSetCode).toEqual('APP');
-// })
-
-// it('testing sortItems method',()=>{
-// let prop: any;
-// component.sortItems(prop);
-
-// })
-
-// it('testing getParentLabel method',()=>{
-// component.getParentLabel(1,"data");
-// })
-
-// describe('should test getParentData',()=>{
-// it('testing getParentData',()=>{
-// let spy=spyOn(adminService,'getParentData').and.returnValue(Observable.of('you object'));
-// component.getParentData();
-// expect(spy).toHaveBeenCalled();
-
-// })
-// })
-
-// describe('should test getLeftMenuItems',()=>{
-// it('testing getLeftMenuItems',()=>{
-// component.getLeftMenuItems();
-// })
-// })
-
-// describe('should test getFunctionCDselectData',()=>{
-// it('testing getFunctionCDselectData',()=>{
-// let spy=spyOn(adminService,'getFunctionCdList').and.returnValue(Observable.of(1,1));
-// component.getFunctionCDselectData();
-// expect(spy).toHaveBeenCalled();
-// })
-// })
-
-// it('should test updateFnMenu method',()=>{
-// //component.updateFnMenu();
-// })
-
- });
+ it('should create', () => {
+ expect(component).toBeTruthy();
+ });
+
+ it('testing ngOnInit method for if condition',()=>{
+ component.selectedMenu=1;
+ component.ngOnInit();
+ expect(component.menu).toEqual(component.selectedMenu);
+ })
+
+ it('testing ngOnInit method for else condition',()=>{
+ component.selectedMenu=0;
+ component.ngOnInit();
+ expect(component.menu.menuSetCode).toEqual('APP');
+ })
+
+ it('testing sortItems method',()=>{
+ let prop: any;
+ component.sortItems(prop);
+
+ })
+
+ it('testing getParentLabel method',()=>{
+ component.getParentLabel(1,"data");
+ })
+
+
+ it('should test getParentData method1 ',()=>{
+ const children="children";
+ let spy=spyOn(adminService,'getParentData').and.returnValue(Observable.of('you object'));
+ component.getParentData();
+ expect(spy).toHaveBeenCalled();
+ })
+
+ describe('should test getLeftMenuItems',()=>{
+ it('testing getLeftMenuItems',()=>{
+ component.getLeftMenuItems();
+ })
+ })
+
+ it('testing getFunctionCDselectData method1',()=>{
+ let spy=spyOn(adminService,'getFunctionCdList').and.returnValue(Observable.of('your object'));
+ component.getFunctionCDselectData();
+ expect(spy).toHaveBeenCalled();
+ })
+
+ it('should test updateFnMenu method',()=>{
+ component.menu.label!=null;
+ component.updateFnMenu();
+ })
+
+});