diff options
Diffstat (limited to 'vid-webpack-master/src/app/shared/server')
-rw-r--r-- | vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.service.spec.ts | 19 | ||||
-rw-r--r-- | vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.service.ts | 7 |
2 files changed, 22 insertions, 4 deletions
diff --git a/vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.service.spec.ts b/vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.service.spec.ts index 147434b1a..0234ea514 100644 --- a/vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.service.spec.ts +++ b/vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.service.spec.ts @@ -37,6 +37,25 @@ describe('Service Info Service', () => { }); }); + describe('#getServicesJobInfo', ()=> { + test('should call without serviceModelId', ()=>{ + let job: ServiceInfoModel = new ServiceInfoModel(); + + service.getServicesJobInfo().subscribe(); + const req = httpMock.expectOne(Constants.Path.SERVICES_JOB_INFO_PATH); + + expect(req.request.method).toBe('GET'); + }); + + test('should call with serviceModelId', ()=>{ + let job: ServiceInfoModel = new ServiceInfoModel(); + + service.getServicesJobInfo(true, "123").subscribe(); + const req = httpMock.expectOne(`${Constants.Path.SERVICES_JOB_INFO_PATH}?${Constants.Path.SERVICE_MODEL_ID}=123`); + expect(req.request.method).toBe('GET'); + }); + }); + describe('#getALaCarteJobAuditStatus Without params', ()=> { test('should return Observable<Object[]>', ()=>{ let job: ServiceInfoModel = new ServiceInfoModel(); diff --git a/vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.service.ts b/vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.service.ts index fe6ebc7ee..388afdba0 100644 --- a/vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.service.ts +++ b/vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.service.ts @@ -2,8 +2,6 @@ import {Injectable} from '@angular/core'; import {Observable} from 'rxjs'; import {ServiceInfoModel} from './serviceInfo.model'; import {HttpClient, HttpHeaders} from '@angular/common/http'; -import { of } from 'rxjs'; -import { map } from 'rxjs/operators'; import {Constants} from '../../utils/constants'; import {forkJoin} from "rxjs/observable/forkJoin"; import * as _ from 'lodash'; @@ -14,10 +12,11 @@ export class ServiceInfoService { constructor(private _http: HttpClient) { } - getServicesJobInfo(filterByUser : boolean, showSpinner: boolean = true): Observable<ServiceInfoModel[]> { + getServicesJobInfo(showSpinner: boolean = true, serviceModelId: string = null): Observable<ServiceInfoModel[]> { let pathQuery = Constants.Path.SERVICES_JOB_INFO_PATH; let headers = new HttpHeaders({'x-show-spinner': showSpinner.toString()}); - return this._http.get<ServiceInfoModel[]>(pathQuery, { headers: headers }).map(res => res ); + let params = serviceModelId ? {serviceModelId} : {}; + return this._http.get<ServiceInfoModel[]>(pathQuery, { headers: headers, params }); } deleteJob(jobId: string): Observable<any> { |