summaryrefslogtreecommitdiffstats
path: root/ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp
diff options
context:
space:
mode:
Diffstat (limited to 'ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp')
-rw-r--r--ecomp-sdk/epsdk-app-overlay/src/main/webapp/ngapp/src/app/pages/admin/menus/menus.component.spec.ts22
1 files changed, 11 insertions, 11 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 eb8b63dd..08e57de2 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
@@ -4,9 +4,7 @@ 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';
-
import { MenusComponent } from './menus.component';
import { InformationModalComponent } from 'src/app/modals/information-modal/information-modal.component';
import { AdminService } from '../admin.service';
@@ -14,17 +12,19 @@ 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';
+import 'rxjs/add/operator/catch';
+import 'rxjs/add/observable/throw';
describe('MenusComponent', () => {
let component: MenusComponent;
let fixture: ComponentFixture<MenusComponent>;
let modalService: any;
let adminService:any;
- var stubData={"data":'{"fnMenuItems":{"tableData":{"element":{"active":1}}}}'};
+ var stubData={
+ "data1":{"data":"cachedRegions"}
+ }
beforeEach(async(() => {
TestBed.configureTestingModule({
@@ -56,11 +56,6 @@ describe('MenusComponent', () => {
expect(component).toBeTruthy();
});
- // 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'))
@@ -76,6 +71,11 @@ describe('MenusComponent', () => {
expect(spy).toHaveBeenCalled();
})
})
-
+ it('should test getParentData method error part ',()=>{
+ let spy=spyOn(adminService,'getParentData').and.returnValue(Observable.throw({status:404}));
+ component.getParentData();
+ expect(spy).toHaveBeenCalled();
+})
+
});