summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.spec.ts26
1 files changed, 21 insertions, 5 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 08e57de2..ff5937a0 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
@@ -1,4 +1,4 @@
-import { async, ComponentFixture, TestBed, inject } from '@angular/core/testing';
+import { async, ComponentFixture, TestBed} from '@angular/core/testing';
import { MatTableModule } from '@angular/material/table';
import { MatPaginatorModule } from '@angular/material/paginator';
import { MatSortModule } from '@angular/material/sort';
@@ -16,15 +16,16 @@ import 'rxjs/add/observable/of';
import { Observable } from 'rxjs/Observable';
import 'rxjs/add/operator/catch';
import 'rxjs/add/observable/throw';
+import { DataTableSettings } from 'portalsdk-tag-lib';
describe('MenusComponent', () => {
let component: MenusComponent;
let fixture: ComponentFixture<MenusComponent>;
let modalService: any;
let adminService:any;
- var stubData={
- "data1":{"data":"cachedRegions"}
- }
+ var stubData={"data":
+ '{"fnMenuItems":[{"active":"active"}]}'
+ }
beforeEach(async(() => {
TestBed.configureTestingModule({
@@ -58,6 +59,22 @@ describe('MenusComponent', () => {
describe('test getMenus',()=>{
it('should test getMenus',()=>{
+ let spy=spyOn(adminService,'getFnMenuItems').and.returnValue(Observable.of(stubData));
+
+ component.getMenus();
+ expect(spy).toHaveBeenCalled();
+ expect(component.settings.columns).toEqual(component.columns);
+ expect(component.settings.isPaginationEnabled).toEqual(true);
+ expect(component.settings.paginationsSize).toEqual("5");
+ expect(component.settings.isReadOnly).toEqual(false);
+ expect(component.settings.isTableSearchEnabled ).toEqual(true);
+ expect(component.settings.applicationService).toEqual(component.menuService);
+ expect(component.showSpinner).toEqual(false);
+ })
+ })
+
+ describe('test getParentData',()=>{
+ it('should test getParentData method',()=>{
let spy=spyOn(adminService,'getParentData').and.returnValue(Observable.of('you object'))
component.getParentData();
expect(spy).toHaveBeenCalled();
@@ -77,5 +94,4 @@ describe('MenusComponent', () => {
component.getParentData();
expect(spy).toHaveBeenCalled();
})
-
});