summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk')
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.spec.ts54
1 files changed, 37 insertions, 17 deletions
diff --git a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.spec.ts b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.spec.ts
index 5627abd0..eb8b63dd 100644
--- a/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.spec.ts
+++ b/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.spec.ts
@@ -2,6 +2,7 @@ import { async, ComponentFixture, TestBed, inject } from '@angular/core/testing'
import { MatTableModule } from '@angular/material/table';
import { MatPaginatorModule } from '@angular/material/paginator';
import { MatSortModule } from '@angular/material/sort';
+import { HttpClientModule } from '@angular/common/http';
import { NoopAnimationsModule } from '@angular/platform-browser/animations';
import { BrowserDynamicTestingModule } from '@angular/platform-browser-dynamic/testing';
import { NgbModule, NgbModal } from '@ng-bootstrap/ng-bootstrap';
@@ -11,12 +12,19 @@ import { InformationModalComponent } from 'src/app/modals/information-modal/info
import { AdminService } from '../admin.service';
import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { HttpClientTestingModule } from '@angular/common/http/testing';
+import { MenusService } from './menus.service';
+import { CookieService } from 'ngx-cookie-service';
+import { MockBackend } from '@angular/http/testing';
+import { BaseRequestOptions, Http } from '@angular/http';
+import 'rxjs/add/observable/of';
+import { Observable } from 'rxjs/Observable';
describe('MenusComponent', () => {
let component: MenusComponent;
let fixture: ComponentFixture<MenusComponent>;
let modalService: any;
- let modalRef: any;
+ let adminService:any;
+ var stubData={"data":'{"fnMenuItems":{"tableData":{"element":{"active":1}}}}'};
beforeEach(async(() => {
TestBed.configureTestingModule({
@@ -26,11 +34,14 @@ describe('MenusComponent', () => {
imports: [ MatTableModule,
MatPaginatorModule,
MatSortModule,
- HttpClientTestingModule,
+ HttpClientModule,
+ HttpClientTestingModule,
NoopAnimationsModule,
- NgbModule.forRoot() ]
- }).
- overrideModule(BrowserDynamicTestingModule, { set: { entryComponents: [InformationModalComponent] } });;
+ NgbModule.forRoot()
+ ],
+ providers:[MenusService,CookieService]
+ })
+ .compileComponents();
}));
beforeEach(async() => {
@@ -38,24 +49,33 @@ describe('MenusComponent', () => {
component = fixture.componentInstance;
fixture.detectChanges();
modalService = TestBed.get(NgbModal);
- modalRef = modalService.open(InformationModalComponent);
- spyOn(modalService, "open").and.returnValue(modalRef);
- spyOn(modalRef, "result").and.returnValue('Ok');
+ adminService=TestBed.get(AdminService);
});
it('should create', () => {
expect(component).toBeTruthy();
});
- // it('should test getDismissReason function to call NgbModal.open function', () => {
- // component.removeMenuItem({'label': 'abc'});
- // expect(modalService.open).toHaveBeenCalled();
- // });
+ // it('should test getFnMenuItems method inside getMenus',()=>{
+ // let spy=spyOn(adminService,'getFnMenuItems').and.returnValue(Observable.of(stubData))
+ // component.getMenus();
+ // expect(spy).toHaveBeenCalled();
+ // })
+ describe('test getMenus',()=>{
+ it('should test getMenus',()=>{
+ let spy=spyOn(adminService,'getParentData').and.returnValue(Observable.of('you object'))
+ component.getParentData();
+ expect(spy).toHaveBeenCalled();
+ })
+ })
-// it('should test getDismissReason function', inject([AdminService],(adminservice) => {
-// let spy = spyOn(adminservice, 'getFnMenuItems');
-// component.getMenus();
-// expect(spy).toHaveBeenCalled();
-// }));
+ describe('testing getFunctionCDselectData',()=>{
+ it('should test getFunctionCDselectData',()=>{
+ let spy=spyOn(adminService,'getFunctionCdList').and.returnValue(Observable.of(1,1));
+ component.getFunctionCDselectData();
+ expect(spy).toHaveBeenCalled();
+ })
+ })
+
});