diff options
author | Ittay Stern <ittay.stern@att.com> | 2018-08-29 17:01:32 +0300 |
---|---|---|
committer | Ittay Stern <ittay.stern@att.com> | 2019-02-18 18:35:30 +0200 |
commit | 6f900cc45d7dd7f97430812b86b5c1d1693c8ae3 (patch) | |
tree | 936005c364dc5a7264d6304d4777c3d83494db22 /vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.service.spec.ts | |
parent | 67d99f816cc583643c35193197594cf78d8ce60a (diff) |
merge from ecomp a88f0072 - Modern UI
Issue-ID: VID-378
Change-Id: Ibcb23dd27f550cf32ce2fe0239f0f496ae014ff6
Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.service.spec.ts')
-rw-r--r-- | vid-webpack-master/src/app/shared/server/serviceInfo/serviceInfo.service.spec.ts | 77 |
1 files changed, 49 insertions, 28 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 78c1b5ab9..147434b1a 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 @@ -9,59 +9,75 @@ describe('Service Info Service', () => { let service: ServiceInfoService; let httpMock: HttpTestingController; - beforeEach(() => { + beforeAll(done => (async () => { TestBed.configureTestingModule({ imports: [HttpClientTestingModule], providers: [ServiceInfoService] }); + await TestBed.compileComponents(); + injector = getTestBed(); service = injector.get(ServiceInfoService); httpMock = injector.get(HttpTestingController); - }); - describe('#getServicesJobInfo', () => { - it('should return an Observable<ServiceInfoModel[]>', () => { - const dummyServiceInfo: ServiceInfoModel[] = generateServiceInfoData(); + })().then(done).catch(done.fail)); - service.getServicesJobInfo(true).subscribe((serviceInfo:Array<ServiceInfoModel>) => { - expect(serviceInfo).toEqual(dummyServiceInfo); - }); - }); + describe('#getMacroJobAuditStatus', ()=> { + test('should return Observable<Object[]>', ()=>{ + let job: ServiceInfoModel = new ServiceInfoModel(); + job.jobId = '111'; + service.getJobAuditStatus(job).subscribe(); + const req = httpMock.expectOne(Constants.Path.SERVICES_JOB_INFO_PATH + Constants.Path.SERVICES_JOB_AUDIT_PATH + '/' + job.jobId + '?source=VID'); + const req2 = httpMock.expectOne(Constants.Path.SERVICES_JOB_INFO_PATH + Constants.Path.SERVICES_JOB_AUDIT_PATH + '/' + job.jobId + '?source=MSO'); + expect(req.request.method).toBe('GET'); + expect(req2.request.method).toBe('GET'); + }); }); - describe('#deleteJob', () =>{ - it('delete job', () => { - const jobId : string = "1111"; - - service.deleteJob(jobId).subscribe(); + describe('#getALaCarteJobAuditStatus Without params', ()=> { + test('should return Observable<Object[]>', ()=>{ + let job: ServiceInfoModel = new ServiceInfoModel(); + job.aLaCarte = true; + job.jobId = '111'; - const req = httpMock.expectOne(Constants.Path.SERVICES_JOB_INFO_PATH + '/job/' + jobId); - expect(req.request.method).toEqual('DELETE'); + service.getJobAuditStatus(job).subscribe(); + const req = httpMock.expectOne(Constants.Path.SERVICES_JOB_INFO_PATH + Constants.Path.SERVICES_JOB_AUDIT_PATH + '/' + job.jobId + '?source=VID'); + const req2 = httpMock.expectOne(Constants.Path.SERVICES_JOB_INFO_PATH + Constants.Path.SERVICES_JOB_AUDIT_PATH + '/' + job.jobId + '/mso'); + expect(req.request.method).toEqual('GET'); + expect(req2.request.method).toEqual('GET'); }); }); - describe('#hideJob', () =>{ - it('when call hide job, there is http POST with right url', () => { - const jobId : string = "3"; + describe('#getALaCarteJobAuditStatus With ServiceInstanceId', ()=> { + test('should return Observable<Object[]>', ()=>{ + let job: ServiceInfoModel = new ServiceInfoModel(); + job.aLaCarte = true; + job.jobId = '111'; + job.serviceInstanceId = '222'; - service.hideJob(jobId).subscribe(); + service.getJobAuditStatus(job).subscribe(); + const req = httpMock.expectOne(Constants.Path.SERVICES_JOB_INFO_PATH + Constants.Path.SERVICES_JOB_AUDIT_PATH + '/' + job.jobId + '?source=VID'); + const req2 = httpMock.expectOne(Constants.Path.SERVICES_JOB_INFO_PATH + Constants.Path.SERVICES_JOB_AUDIT_PATH + '/' + job.jobId + '/mso?serviceInstanceId=' + job.serviceInstanceId); - const req = httpMock.expectOne(Constants.Path.SERVICES_JOB_INFO_PATH + '/hide/' + jobId); - expect(req.request.method).toEqual('POST'); + expect(req.request.method).toEqual('GET'); + expect(req2.request.method).toEqual('GET'); }); }); - describe('#getJobAuditStatus', ()=> { - it('should return Observable<Object[]>', ()=>{ - const jobId : string = '111'; + describe('#getALaCarteJobAuditStatus With RequestId', ()=> { + test('should return Observable<Object[]>', ()=>{ + let job: ServiceInfoModel = new ServiceInfoModel(); + job.aLaCarte = true; + job.jobId = '111'; + job.requestId = '333'; - service.getJobAuditStatus(jobId).subscribe(); - const req = httpMock.expectOne(Constants.Path.SERVICES_JOB_INFO_PATH + Constants.Path.SERVICES_JOB_AUDIT_PATH + '/' + jobId + '?source=VID'); - const req2 = httpMock.expectOne(Constants.Path.SERVICES_JOB_INFO_PATH + Constants.Path.SERVICES_JOB_AUDIT_PATH + '/' + jobId + '?source=MSO'); + service.getJobAuditStatus(job).subscribe(); + const req = httpMock.expectOne(Constants.Path.SERVICES_JOB_INFO_PATH + Constants.Path.SERVICES_JOB_AUDIT_PATH + '/' + job.jobId + '?source=VID'); + const req2 = httpMock.expectOne(Constants.Path.SERVICES_JOB_INFO_PATH + Constants.Path.SERVICES_JOB_AUDIT_PATH + '/' + job.jobId + '/mso?requestId=' + job.requestId); expect(req.request.method).toEqual('GET'); expect(req2.request.method).toEqual('GET'); @@ -73,6 +89,7 @@ describe('Service Info Service', () => { [{ "created": 1519956533000, "modified": 1521727738000, + "action": "INSTANTIATE", "createdId": null, "modifiedId": null, "rowNum": null, @@ -105,6 +122,7 @@ describe('Service Info Service', () => { { "created": 1519956533000, "modified": 1521727738000, + "action": "INSTANTIATE", "createdId": null, "modifiedId": null, "rowNum": null, @@ -137,6 +155,7 @@ describe('Service Info Service', () => { { "created": 1519956533000, "modified": 1521727738000, + "action": "INSTANTIATE", "createdId": null, "modifiedId": null, "rowNum": null, @@ -169,6 +188,7 @@ describe('Service Info Service', () => { { "created": 1519956533000, "modified": 1521727738000, + "action": "INSTANTIATE", "createdId": null, "modifiedId": null, "rowNum": null, @@ -201,6 +221,7 @@ describe('Service Info Service', () => { { "created": 1519956533000, "modified": 1521727738000, + "action": "INSTANTIATE", "createdId": null, "modifiedId": null, "rowNum": null, |