test(indicadores): follow the published CAM-03 title and the Análisis tab

The history names CAM-03 «Resultado histopatológico»; the CAM-03 expectation in the F4C spec
now uses that title.

The CaMa page does not offer the Análisis tab while CAMA_ANALYSIS_ENABLED is off. The journey
specs that open it run only while the flag is on and are reported as skipped otherwise. The
domain-change spec selects patients through the page instead of through that tab, so it keeps
checking that the selection is cleared and that CaCu and TEA keep their sections.
This commit is contained in:
Angel Capetillo Zavala
2026-11-18 23:41:41 -06:00
parent 58ff3870be
commit baf5edca42
3 changed files with 14 additions and 11 deletions
@@ -138,8 +138,8 @@ describe('CAM-01, CAM-02 y CAM-03 en el panel histórico', () => {
'/cama/indicadores/cama_dias_resultado_diagnostico/datos?periodos=2025-S1',
'/cama/indicadores/cama_tasa_deteccion_histopatologica/datos?periodos=2025-S1'].sort((a, b) => pedidos.indexOf(a) - pedidos.indexOf(b)));
const titulos = paneles().map(p => [p.querySelector('h2')!.textContent, p.textContent!.includes('Integración pendiente') ? 'pendiente' : 'dibujado']);
expect(titulos.filter(([t]) => ['Resultado histopatológico por categoría BI-RADS', 'Días del resultado de la mastografía al diagnóstico', 'Tasa de detección histopatológica'].includes(t!)))
.toEqual([['Resultado histopatológico por categoría BI-RADS', 'dibujado'], ['Días del resultado de la mastografía al diagnóstico', 'dibujado'], ['Tasa de detección histopatológica', 'dibujado']]);
expect(titulos.filter(([t]) => ['Resultado histopatológico', 'Días del resultado de la mastografía al diagnóstico', 'Tasa de detección histopatológica'].includes(t!)))
.toEqual([['Resultado histopatológico', 'dibujado'], ['Días del resultado de la mastografía al diagnóstico', 'dibujado'], ['Tasa de detección histopatológica', 'dibujado']]);
expect(graficas()).toHaveLength(3);
expect(graficas().map(g => g.figure!.data.length)).toEqual([6, 2, 2]);
});
@@ -42,7 +42,8 @@ const SECTIONS: readonly { id: DashboardSection; label: string }[] = [
// TEA and CaMa have enough periods for their history to say anything; the epidemiological analysis is CaMa's,
// between its history and its follow-up list.
const SECTIONS_WITH_HISTORY: readonly { id: DashboardSection; label: string }[] = [SECTIONS[0], { id: 'historico', label: 'Histórico' }, SECTIONS[1], SECTIONS[2]];
const CAMA_ANALYSIS_ENABLED = false;
// Whether CaMa offers the Análisis tab. While off, its panel is a placeholder and the component is not rendered.
export const CAMA_ANALYSIS_ENABLED = false;
const SECTIONS_CAMA: readonly { id: DashboardSection; label: string }[] = [
SECTIONS_WITH_HISTORY[0], SECTIONS_WITH_HISTORY[1],
...(CAMA_ANALYSIS_ENABLED ? [{ id: 'analisis' as const, label: 'Análisis' }] : []),
@@ -2,6 +2,8 @@
// «Volver al análisis», with the analysis as it was and the focus on the control that opened the list; the selection going
// with the domain; CaCu and TEA keeping their three sections; and the wording of every screen of the journey.
// Fixtures: indicadores-analisis.testing.ts (the aggregate) and fixtures/cama_seguimiento.json (the list).
// The journey through the Análisis tab only runs while the page offers that tab (CAMA_ANALYSIS_ENABLED); with it
// withdrawn those tests are reported as skipped, and the selection and sections tests keep running without it.
import { Component, output } from '@angular/core';
import { TestBed } from '@angular/core/testing';
import { provideHttpClient, withInterceptors } from '@angular/common/http';
@@ -11,8 +13,8 @@ import { RouterTestingHarness } from '@angular/router/testing';
import { routes } from '../../app.routes';
import { PlotlyChart } from '../../shared/plotly/plotly-chart';
import fixtureData from './fixtures/cama_seguimiento.json';
import { IndicadoresPage } from './indicadores-page';
import { IndicadoresAnalisis, hoyIso } from './indicadores-analisis';
import { CAMA_ANALYSIS_ENABLED, IndicadoresPage } from './indicadores-page';
import { IndicadoresAnalisis, hoyIso, seleccionDeGrupo } from './indicadores-analisis';
import { IndicadorFigureCard } from './indicador-figure-card';
import { agregadoJson, CONTEXTO, listaCohorte, sinAnalisisDescriptivo } from './indicadores-analisis.testing';
import { kpiQueriesProvider, periodAvailabilityProvider } from './indicadores-periodos.testing';
@@ -22,6 +24,7 @@ import { Indicador } from './indicadores.models';
class ChartStub { readonly plotClick = output<unknown>(); }
const catalogoCama: Indicador[] = [{ id: 'published', titulo: 'Nombre publicado', contrato: 'C2', figuras: ['fig_c2_barras'], tipos_periodo: ['mes'] }];
const conAnalisis = CAMA_ANALYSIS_ENABLED ? it : it.skip;
const base = () => structuredClone(fixtureData) as unknown as Record<string, any>;
// What the cohort's list answers to the group BI-RADS 5: the whole cohort, the cut-off asked for, the filter applied and the cohort quoted back.
const cohorte = (corte: string) => ({ ...base(), ...CONTEXTO, corte, ventana: { meses: 0, desde: '2025-01-01', hasta: corte },
@@ -63,7 +66,7 @@ describe('Recorrido de cáncer de mama: análisis, lista, ficha y regreso', () =
const lista = () => http.expectOne(q => q.url === '/cama/seguimiento');
const parametros = (r: ReturnType<typeof lista>) => Object.fromEntries(r.request.params.keys().map(k => [k, r.request.params.get(k)]));
it('Ver pacientes abre la lista de ese grupo; la ficha y el regreso conservan la lista, el análisis y el foco', async () => {
conAnalisis('Ver pacientes abre la lista de ese grupo; la ficha y el regreso conservan la lista, el análisis y el foco', async () => {
// Fails if any step of the journey drops the selection, repeats a request, loses the focus or the answer already loaded.
const e = await entrar();
await abrirAnalisis(e);
@@ -105,7 +108,7 @@ describe('Recorrido de cáncer de mama: análisis, lista, ficha y regreso', () =
http.expectNone(q => q.url === '/cama/seguimiento');
expect(e.panel('seguimiento').textContent).toContain('BI-RADS 5');
});
it('el corte que el usuario elige llega al agregado, al listado, a la ficha y al archivo descargado', async () => {
conAnalisis('el corte que el usuario elige llega al agregado, al listado, a la ficha y al archivo descargado', async () => {
// Fails if any step of the journey is read at another cut-off than the chosen one, or the file does not say it.
const ELEGIDO = '2026-09-01';
const descargas: string[] = [];
@@ -135,7 +138,7 @@ describe('Recorrido de cáncer de mama: análisis, lista, ficha y regreso', () =
expect(descargas).toHaveLength(1);
expect(descargas[0]).toMatch(/^seguimiento-cancer-de-mama-seleccion_corte-2026-09-01_/);
});
it('si la cohorte cambió desde el análisis (409), la lista lo dice sin mostrar filas y el análisis sigue como estaba', async () => {
conAnalisis('si la cohorte cambió desde el análisis (409), la lista lo dice sin mostrar filas y el análisis sigue como estaba', async () => {
// Fails if a stale revision shows rows, or the way back to the analysis is lost with the error.
const e = await entrar();
await abrirAnalisis(e);
@@ -150,8 +153,7 @@ describe('Recorrido de cáncer de mama: análisis, lista, ficha y regreso', () =
it('al cambiar de dominio la selección se limpia; CaCu y TEA no tienen Análisis y conservan sus secciones', async () => {
// Fails if a selection survives into another domain, or the analysis tab leaks into CaCu or TEA.
const e = await entrar();
await abrirAnalisis(e);
e.root.querySelector<HTMLButtonElement>('tr[data-grupo="BIRADS_5"] button.ver')!.click(); e.harness.detectChanges();
e.page.verPacientes(seleccionDeGrupo(agregadoJson({ corte }), 'BIRADS_5')!); e.harness.detectChanges();
lista().flush(cohorte(corte)); await e.asentar();
expect(e.page.seleccionSeguimiento()).toBeDefined();
for (const dominio of ['cacu', 'tea'] as const) {
@@ -167,7 +169,7 @@ describe('Recorrido de cáncer de mama: análisis, lista, ficha y regreso', () =
expect(e.page.seleccionSeguimiento()).toBeUndefined();
expect(e.root.querySelector('.seleccion')).toBeNull();
});
it('la pestaña Análisis sin endpoint publicado dice que está pendiente, sin ocultarlo ni mostrarlo como error', async () => {
conAnalisis('la pestaña Análisis sin endpoint publicado dice que está pendiente, sin ocultarlo ni mostrarlo como error', async () => {
// Fails if the missing endpoint is hidden or shown as a broken page, or the wording leaks the environment.
const e = await entrar();
e.tab('analisis').click(); e.harness.detectChanges();