summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLorraine Welch <lb2391@att.com>2020-05-04 13:43:17 +0000
committerGerrit Code Review <gerrit@onap.org>2020-05-04 13:43:17 +0000
commit1ba6611803edc1967be99a4660031635b14149dd (patch)
tree6a549d2ed8cd0e7f8991afa8a8797f4910f8c0c7
parent1466d0648f0bfc0ee27745c39007d0c34c4557dd (diff)
parent5d694cc24929391a34d60ea06431d4038e86347c (diff)
Merge "test cases in menus component"
-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();
})
-
});