X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=webapp-frontend%2Fsrc%2Fapp%2Fei-coordinator%2Fei-job.datasource.spec.ts;h=c50f69e13e05edb3ffd0b3dbe0dbd1796d4de34e;hb=8ce8fccb49a3c082c9fde5f20335af8e85b41584;hp=cb530a623111af43255324decb189229de6c4a8a;hpb=87ffca501cf3dca8dfb050b56f5c3bf9b742b651;p=portal%2Fnonrtric-controlpanel.git diff --git a/webapp-frontend/src/app/ei-coordinator/ei-job.datasource.spec.ts b/webapp-frontend/src/app/ei-coordinator/ei-job.datasource.spec.ts index cb530a6..c50f69e 100644 --- a/webapp-frontend/src/app/ei-coordinator/ei-job.datasource.spec.ts +++ b/webapp-frontend/src/app/ei-coordinator/ei-job.datasource.spec.ts @@ -17,12 +17,11 @@ * limitations under the License. * ========================LICENSE_END=================================== */ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; -import { BehaviorSubject, of } from 'rxjs'; +import { TestBed } from '@angular/core/testing'; +import { of } from 'rxjs'; import { EIJobDataSource } from './ei-job.datasource'; import { EIService } from '../services/ei/ei.service'; -import { NotificationService } from '../services/ui/notification.service'; import { ToastrModule } from 'ngx-toastr'; import { EIJob } from '../interfaces/ei.types'; @@ -30,7 +29,7 @@ describe('EIJobDataSource', () => { let dataSource: EIJobDataSource; let eiServiceSpy: any; - let job = { ei_job_identity: '1', ei_job_data: 'data', ei_type_identity: 'Type ID 1', target_uri: 'hhtp://url', owner: 'owner'}; + const job = { ei_job_identity: '1', ei_job_data: 'data', ei_type_identity: 'Type ID 1', target_uri: 'hhtp://url', owner: 'owner'}; beforeEach(() => { eiServiceSpy = jasmine.createSpyObj('EIService', ['getProducerIds', 'getJobsForProducer']); @@ -40,22 +39,20 @@ describe('EIJobDataSource', () => { TestBed.configureTestingModule({ imports: [ToastrModule.forRoot()], providers: [ - { provide: EIService, useValue: eiServiceSpy }, - NotificationService + { provide: EIService, useValue: eiServiceSpy } ] }); }); it('should create', () => { - dataSource = TestBed.get(EIJobDataSource); + dataSource = TestBed.inject(EIJobDataSource); expect(dataSource).toBeTruthy(); }); - it('#getJobs and connect', () => { - dataSource.getJobs(); - const jobsSubject: BehaviorSubject = dataSource.eiJobsSubject; - const value = jobsSubject.getValue(); - expect(value).toEqual([ job, job ]); + it('#getJobs', () => { + dataSource.loadJobs(); + const actualJobs: EIJob[] = dataSource.eiJobs(); + expect(actualJobs).toEqual([ job, job ]); expect(dataSource.rowCount).toEqual(2); }); });