+
+ describe('#getEIProducers', () => {
+ let expectedEIProducerIds: String[];
+
+ beforeEach(() => {
+ service = TestBed.get(EIService);
+ httpTestingController = TestBed.get(HttpTestingController);
+ expectedEIProducerIds = [ 'producer1', 'producer2' ] as String[];
+ });
+
+ it('should return all producer IDs', () => {
+ service.getProducerIds().subscribe(
+ producers => expect(producers).toEqual(expectedEIProducerIds, 'should return expected EIProducer IDs'),
+ fail
+ );
+
+ const req = httpTestingController.expectOne(basePath + '/' + service.eiProducersPath);
+ expect(req.request.method).toEqual('GET');
+
+ req.flush(expectedEIProducerIds); //Return expected producer IDs
+
+ httpTestingController.verify();
+ });
+ });
+
+ describe('#EIJobs', () => {
+ let expectedEIJobs: EIJob[];
+
+ beforeEach(() => {
+ service = TestBed.get(EIService);
+ httpTestingController = TestBed.get(HttpTestingController);
+ expectedEIJobs = [
+ { ei_job_identity: '1', ei_job_data: 'data', ei_type_identity: 'Type ID 1', target_uri: 'hhtp://url', owner: 'owner'},
+ { ei_job_identity: '2', ei_job_data: 'EI Job 2', ei_type_identity: 'Type ID 2', target_uri: 'hhtp://url', owner: 'owner'}
+ ] as EIJob[];
+ });
+
+ it('should return all jobs', () => {
+ service.getJobsForProducer('producer1').subscribe(
+ jobs => expect(jobs).toEqual(expectedEIJobs, 'should return expected Jobs'),
+ fail
+ );
+
+ const req = httpTestingController.expectOne(basePath + '/' + service.eiProducersPath + '/producer1/' + service.eiJobsPath);
+ expect(req.request.method).toEqual('GET');
+
+ req.flush(expectedEIJobs); //Return expectedEIJobs
+
+ httpTestingController.verify();
+ });
+ });