Agrupar las tarjetas de CaMa y elegir el periodo en Trazabilidad

This commit is contained in:
2026-12-03 22:21:59 -06:00
parent 84769cb0f4
commit 2a84eb56ca
12 changed files with 142 additions and 120 deletions
+11 -1
View File
@@ -1,6 +1,6 @@
import type { RiskAssessment } from 'fhir/r4';
import { ageGroup, currentRisk, windowStart, ageAt, bornFor } from './follow-up';
import { periods } from './measures';
import { historyPeriods, periods } from './measures';
describe('follow-up list', () => {
it('starts the window the day after the same day months before (core.follow_up)', () => {
@@ -36,6 +36,16 @@ describe('follow-up list', () => {
expect(currentRisk(risks, 'cin2', 3)).toBeUndefined();
});
it('ends history at the selected complete period for months and semesters', () => {
const monthly = historyPeriods('month', '2025-03');
expect(monthly.slice(-3)).toEqual(['2025-01', '2025-02', '2025-03']);
expect(monthly).toHaveLength(72);
const firstSemester = historyPeriods('semester', '2025-S1');
expect(firstSemester.slice(-3)).toEqual(['2024-S1', '2024-S2', '2025-S1']);
const secondSemester = historyPeriods('semester', '2025-S2');
expect(secondSemester.slice(-2)).toEqual(['2025-S1', '2025-S2']);
});
it('lists periods most recent first', () => {
expect(periods('semester', 1, new Date(2026, 10, 25))).toEqual(['2026-S2', '2026-S1']);
expect(periods('month', 1, new Date(2026, 1, 3)).slice(0, 3)).toEqual([