7ddaf6324d6d4e7ab527b249e5f746205d8f2e73
[portal/sdk.git] /
1 /*
2  * ============LICENSE_START==========================================
3  * ONAP Portal SDK
4  * ===================================================================
5  * Copyright © 2019 AT&T Intellectual Property. All rights reserved.
6  * ===================================================================
7  * 
8  *  * Modification Copyright © 2020 IBM.
9  * ===================================================================
10
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
15  *
16  *             http://www.apache.org/licenses/LICENSE-2.0
17  *
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.
23  *
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
28  *
29  *             https://creativecommons.org/licenses/by/4.0/
30  *
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.
36  *
37  * ============LICENSE_END============================================
38  *
39  * 
40  */
41
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';
58
59
60 describe('NewMenuComponent', () => {
61   let component: NewMenuComponent;
62   let fixture: ComponentFixture<NewMenuComponent>;
63   let adminService:AdminService;
64  // let entryComponents:any;
65
66   beforeEach(async(() => {
67     TestBed.configureTestingModule({
68       declarations: [ NewMenuComponent ],
69       imports:[FormsModule, HttpClientTestingModule,RouterTestingModule,NgbModalModule,BrowserAnimationsModule],
70       providers:[AdminService,NgbActiveModal,CookieService,MockBackend,BaseRequestOptions,{
71         provide:Http,
72         useFactory:(backend:MockBackend,defaultOptions:BaseRequestOptions)=>{
73           return new Http(backend,defaultOptions);
74         },
75         deps:[MockBackend,BaseRequestOptions],
76         entryComponents:[ConfirmationModalComponent]
77       }],   
78     })
79     .compileComponents();
80     
81   }));
82
83   beforeEach(() => {
84     fixture = TestBed.createComponent(NewMenuComponent);
85     component = fixture.componentInstance;
86     fixture.detectChanges();
87     adminService=TestBed.get(AdminService);
88   });
89
90 //   // it('should create', () => {
91 //   //   expect(component).toBeTruthy();
92 //   // });
93
94 //   it('testing ngOnInit method for if condition',()=>{
95 //     component.selectedMenu=1;
96 //     component.ngOnInit();
97 //     expect(component.menu).toEqual(component.selectedMenu);
98 //   })
99
100 //   it('testing ngOnInit method for else condition',()=>{
101 //     component.selectedMenu=0;
102 //     component.ngOnInit();
103 //     expect(component.menu.menuSetCode).toEqual('APP');
104 //   })
105
106 //   it('testing sortItems method',()=>{
107 //     let prop: any;
108 //       component.sortItems(prop);
109
110 //   })
111
112 //   it('testing getParentLabel method',()=>{
113 //     component.getParentLabel(1,"data");
114 //   })
115
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();
121
122 //   })
123 //   })
124
125 //   describe('should test getLeftMenuItems',()=>{
126 //   it('testing getLeftMenuItems',()=>{
127 //     component.getLeftMenuItems();
128 //   })
129 //   })
130
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();
136 //     })
137 //   })
138
139 //   it('should test updateFnMenu method',()=>{
140 //     //component.updateFnMenu();
141 //   })
142
143  });