summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay
diff options
context:
space:
mode:
authorIndrijeet kumar <indriku1@in.ibm.com>2020-04-30 22:30:02 +0530
committerIndrijeet Kumar <indriku1@in.ibm.com>2020-05-03 02:44:21 +0000
commit5d694cc24929391a34d60ea06431d4038e86347c (patch)
tree9d7424efad18b98884c63251fdc4668fcc4b4763 /ecomp-sdk/epsdk-app-overlay
parentc7f033eec8a0a88a2ae0d200b5cc5f25fe41e70f (diff)
test cases in menus component
test cases in menus component Issue-ID: PORTAL-813 Change-Id: I795a08adfb09ced5b69086c30a92af23ebad34fe Signed-off-by: Indrijeet Kumar <indriku1@in.ibm.com>
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay')
-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();
})
-
});