diff --git a/test/pantallas/pantalla_alarmas_tier5_test.dart b/test/pantallas/pantalla_alarmas_tier5_test.dart index 176e83e..f05b34c 100644 --- a/test/pantallas/pantalla_alarmas_tier5_test.dart +++ b/test/pantallas/pantalla_alarmas_tier5_test.dart @@ -2,6 +2,7 @@ import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:pluriwave/estado/estado_alarmas.dart'; import 'package:pluriwave/estado/estado_radio.dart'; +import 'package:pluriwave/l10n/formato_fechas.dart'; import 'package:pluriwave/l10n/gen/app_localizations.dart'; import 'package:pluriwave/modelos/alarma_musical.dart'; import 'package:pluriwave/modelos/emisora.dart'; @@ -137,16 +138,29 @@ void main() { ) async { final estado = crearEstado(); addTearDown(estado.dispose); + // The pill only renders for the ACTIVE or NEXT range + // (`EstadoAlarmas.vacacionesProximas` keeps `inicioDia.isAfter(hoy)`), so + // the range has to be in the future RELATIVE TO THE RUN. Hardcoded + // calendar dates silently rot into the past and turn this into a + // date-dependent failure; anchor on next month instead, days 4-18 so the + // range never straddles a month boundary and the label stays "d–d MON". + final ahora = DateTime.now(); + final mesSiguiente = DateTime(ahora.year, ahora.month + 1); + final inicio = DateTime(mesSiguiente.year, mesSiguiente.month, 4); + final fin = DateTime(mesSiguiente.year, mesSiguiente.month, 18); await estado.crearRangoVacaciones( estado.servicio.crearRangoVacaciones( - inicio: DateTime(2026, 8, 4), - fin: DateTime(2026, 8, 18), + inicio: inicio, + fin: fin, nombre: 'Summer', ), ); await montar(tester, estadoAlarmas: estado); - expect(find.text('4–18 AUG'), findsOneWidget); + // Assert against the same pure formatter the widget uses, so this stays + // a check that the pill IS rendered in the right shape rather than a + // duplicate of the formatter's own logic. + expect(find.text(rangoFechasCorto('en', inicio, fin)), findsOneWidget); }); });