diff options
author | Lorraine Welch <lb2391@att.com> | 2020-04-17 19:17:36 +0000 |
---|---|---|
committer | Gerrit Code Review <gerrit@onap.org> | 2020-04-17 19:17:36 +0000 |
commit | d9935ff090351779bbced307a9d302a90bc6a626 (patch) | |
tree | 3687e5a57738b83e2740f8d164983473818db149 /ecomp-sdk | |
parent | e6890a9ea013c0494d49380bf2df17e54caac2a5 (diff) | |
parent | 20bf5cb610726771a9c540f0cbf9697e327994f7 (diff) |
Merge "test cases in menus component"
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.ts | 22 |
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(); +}) + }); |