|
|
|
@@ -1,4 +1,4 @@
|
|
|
|
|
// What this covers: reading the WebApi's FHIR `MeasureReport` bundles (`/<domain>/kpis/<id>`) into a series, drawing
|
|
|
|
|
// What this covers: reading the WebApi's FHIR `MeasureReport` bundles (`/<domain>/indicadores/<id>`) into a series, drawing
|
|
|
|
|
// it here, the service that asks for it and the component that shows it.
|
|
|
|
|
// Fixtures: `cacu_ind1_measure_report_bundle.json` (IND1, 2025-S1 and 2025-S2) and
|
|
|
|
|
// `cacu_eu13_measure_report_bundle.json` (EU13, 2025-S1, with the `grupo_edad` stratifier) and
|
|
|
|
@@ -83,7 +83,7 @@ describe('MeasureReportService and IndicadorMeasureReport', () => {
|
|
|
|
|
// the URL or a parameter's name drifts from the WebApi's.
|
|
|
|
|
const answer = firstValueFrom(TestBed.inject(MeasureReportService)
|
|
|
|
|
.series('cacu', 'IND1', ['2025-S1', '2025-S2'], { evento: '2025-12-31' }));
|
|
|
|
|
const request = TestBed.inject(HttpTestingController).expectOne(r => r.url === '/cacu/kpis/IND1');
|
|
|
|
|
const request = TestBed.inject(HttpTestingController).expectOne(r => r.url === '/cacu/indicadores/IND1');
|
|
|
|
|
expect(request.request.params.get('periodos')).toBe('2025-S1,2025-S2');
|
|
|
|
|
expect(request.request.params.get('corte_evento')).toBe('2025-12-31');
|
|
|
|
|
expect(request.request.params.has('corte_conocimiento')).toBe(false);
|
|
|
|
@@ -97,7 +97,7 @@ describe('MeasureReportService and IndicadorMeasureReport', () => {
|
|
|
|
|
const fixture = TestBed.createComponent(IndicadorMeasureReport);
|
|
|
|
|
Object.assign(fixture.componentInstance, { dominio: 'cacu', indicador: 'IND1', titulo: 'IND1', periodos: ['2025-S1', '2025-S2'] });
|
|
|
|
|
fixture.componentInstance.ngOnChanges();
|
|
|
|
|
TestBed.inject(HttpTestingController).expectOne(r => r.url === '/cacu/kpis/IND1').flush(IND1);
|
|
|
|
|
TestBed.inject(HttpTestingController).expectOne(r => r.url === '/cacu/indicadores/IND1').flush(IND1);
|
|
|
|
|
fixture.detectChanges();
|
|
|
|
|
expect(fixture.componentInstance.status()).toBe('ready');
|
|
|
|
|
expect(fixture.componentInstance.figure()?.data[0]['y']).toEqual([25, 25]);
|
|
|
|
@@ -161,22 +161,22 @@ describe('KpisPage', () => {
|
|
|
|
|
beforeEach(() => TestBed.configureTestingModule({ providers: [provideHttpClient(), provideHttpClientTesting()] }));
|
|
|
|
|
|
|
|
|
|
it('draws every measure the WebApi lists, each from its reports', () => {
|
|
|
|
|
// Pins down: the page needs nothing per measure: it lists `/cacu/kpis` and draws proportions, compositions
|
|
|
|
|
// Pins down: the page needs nothing per measure: it lists `/cacu/indicadores` and draws proportions, compositions
|
|
|
|
|
// and durations from the one contract. Fails if a scoring stops being drawn or the page starts naming measures.
|
|
|
|
|
TestBed.overrideComponent(KpisPage, { remove: { imports: [PlotlyChart] }, add: { imports: [ChartStub] } });
|
|
|
|
|
const fixture = TestBed.createComponent(KpisPage);
|
|
|
|
|
fixture.componentInstance.ngOnInit();
|
|
|
|
|
const http = TestBed.inject(HttpTestingController);
|
|
|
|
|
http.expectOne('/cacu/kpis').flush([
|
|
|
|
|
http.expectOne('/cacu/indicadores').flush([
|
|
|
|
|
{ id: 'IND1', url: 'cacu/IND1', version: '0.3.2', scoring: 'proportion' },
|
|
|
|
|
{ id: 'CACU_EU13', url: 'cacu/CACU_EU13', version: '0.3.2', scoring: 'proportion' },
|
|
|
|
|
{ id: 'CACU_EU7', url: 'cacu/CACU_EU7', version: '0.3.3', scoring: 'composition' },
|
|
|
|
|
{ id: 'CACU_DIAS_TOMA_DIAGNOSTICO', url: 'cacu/CACU_DIAS_TOMA_DIAGNOSTICO', version: '0.2.3', scoring: 'continuous-variable' },
|
|
|
|
|
]);
|
|
|
|
|
http.expectOne(r => r.url === '/cacu/kpis/IND1').flush(IND1);
|
|
|
|
|
http.expectOne(r => r.url === '/cacu/kpis/CACU_EU13').flush(EU13);
|
|
|
|
|
http.expectOne(r => r.url === '/cacu/kpis/CACU_EU7').flush(EU7);
|
|
|
|
|
http.expectOne(r => r.url === '/cacu/kpis/CACU_DIAS_TOMA_DIAGNOSTICO').flush(DIAS);
|
|
|
|
|
http.expectOne(r => r.url === '/cacu/indicadores/IND1').flush(IND1);
|
|
|
|
|
http.expectOne(r => r.url === '/cacu/indicadores/CACU_EU13').flush(EU13);
|
|
|
|
|
http.expectOne(r => r.url === '/cacu/indicadores/CACU_EU7').flush(EU7);
|
|
|
|
|
http.expectOne(r => r.url === '/cacu/indicadores/CACU_DIAS_TOMA_DIAGNOSTICO').flush(DIAS);
|
|
|
|
|
fixture.detectChanges();
|
|
|
|
|
expect(fixture.componentInstance.status()).toBe('ready');
|
|
|
|
|
expect(fixture.componentInstance.figures().map(f => f.id)).toEqual(['IND1', 'CACU_EU13', 'CACU_EU7', 'CACU_DIAS_TOMA_DIAGNOSTICO']);
|
|
|
|
|