2 * ============LICENSE_START==========================================
4 * ===================================================================
5 * Copyright © 2019 AT&T Intellectual Property. All rights reserved.
6 * ===================================================================
8 * * Modification Copyright © 2020 IBM.
9 * ===================================================================
11 * Unless otherwise specified, all software contained herein is licensed
12 * under the Apache License, Version 2.0 (the "License");
13 * you may not use this software except in compliance with the License.
14 * You may obtain a copy of the License at
16 * http://www.apache.org/licenses/LICENSE-2.0
18 * Unless required by applicable law or agreed to in writing, software
19 * distributed under the License is distributed on an "AS IS" BASIS,
20 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 * See the License for the specific language governing permissions and
22 * limitations under the License.
24 * Unless otherwise specified, all documentation contained herein is licensed
25 * under the Creative Commons License, Attribution 4.0 Intl. (the "License");
26 * you may not use this documentation except in compliance with the License.
27 * You may obtain a copy of the License at
29 * https://creativecommons.org/licenses/by/4.0/
31 * Unless required by applicable law or agreed to in writing, documentation
32 * distributed under the License is distributed on an "AS IS" BASIS,
33 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
34 * See the License for the specific language governing permissions and
35 * limitations under the License.
37 * ============LICENSE_END============================================
42 import { async, ComponentFixture, TestBed } from '@angular/core/testing';
43 import {FormsModule} from '@angular/forms';
44 import { NewMenuComponent } from './new-menu.component';
45 import { HttpClientTestingModule } from '@angular/common/http/testing';
46 import { NgbActiveModal, NgbModalModule } from '@ng-bootstrap/ng-bootstrap';
47 import { RouterTestingModule } from '@angular/router/testing';
48 import { CookieService } from 'ngx-cookie-service';
49 import { MockBackend } from '@angular/http/testing';
50 import { BaseRequestOptions, Http } from '@angular/http';
51 import { AdminService } from '../../admin.service';
52 import 'rxjs/add/operator/toPromise';
53 import { ConfirmationModalComponent } from 'src/app/modals/confirmation-modal/confirmation-modal.component';
54 import { BrowserAnimationsModule } from '@angular/platform-browser/animations';
55 import { MaterialModule } from 'portalsdk-tag-lib/material-module';
56 import 'rxjs/add/observable/of';
57 import { Observable } from 'rxjs/Observable';
60 describe('NewMenuComponent', () => {
61 let component: NewMenuComponent;
62 let fixture: ComponentFixture<NewMenuComponent>;
63 let adminService:AdminService;
64 // let entryComponents:any;
66 beforeEach(async(() => {
67 TestBed.configureTestingModule({
68 declarations: [ NewMenuComponent ],
69 imports:[FormsModule, HttpClientTestingModule,RouterTestingModule,NgbModalModule,BrowserAnimationsModule],
70 providers:[AdminService,NgbActiveModal,CookieService,MockBackend,BaseRequestOptions,{
72 useFactory:(backend:MockBackend,defaultOptions:BaseRequestOptions)=>{
73 return new Http(backend,defaultOptions);
75 deps:[MockBackend,BaseRequestOptions],
76 entryComponents:[ConfirmationModalComponent]
84 fixture = TestBed.createComponent(NewMenuComponent);
85 component = fixture.componentInstance;
86 fixture.detectChanges();
87 adminService=TestBed.get(AdminService);
90 // // it('should create', () => {
91 // // expect(component).toBeTruthy();
94 // it('testing ngOnInit method for if condition',()=>{
95 // component.selectedMenu=1;
96 // component.ngOnInit();
97 // expect(component.menu).toEqual(component.selectedMenu);
100 // it('testing ngOnInit method for else condition',()=>{
101 // component.selectedMenu=0;
102 // component.ngOnInit();
103 // expect(component.menu.menuSetCode).toEqual('APP');
106 // it('testing sortItems method',()=>{
108 // component.sortItems(prop);
112 // it('testing getParentLabel method',()=>{
113 // component.getParentLabel(1,"data");
116 // describe('should test getParentData',()=>{
117 // it('testing getParentData',()=>{
118 // let spy=spyOn(adminService,'getParentData').and.returnValue(Observable.of('you object'));
119 // component.getParentData();
120 // expect(spy).toHaveBeenCalled();
125 // describe('should test getLeftMenuItems',()=>{
126 // it('testing getLeftMenuItems',()=>{
127 // component.getLeftMenuItems();
131 // describe('should test getFunctionCDselectData',()=>{
132 // it('testing getFunctionCDselectData',()=>{
133 // let spy=spyOn(adminService,'getFunctionCdList').and.returnValue(Observable.of(1,1));
134 // component.getFunctionCDselectData();
135 // expect(spy).toHaveBeenCalled();
139 // it('should test updateFnMenu method',()=>{
140 // //component.updateFnMenu();