fix(alarmas): decode native failures with the real channel key names

The first pass read 'alarmaId'/'tipo' from the channel payload while the
native side sends 'alarmId'/'type'/'atMillis' (AlarmScheduler.kt:1389).
Every entry would have been dropped silently in production.

The tests passed because the fake was seeded with the same guessed keys,
so they confirmed the mistake instead of catching it. Decoding now goes
through FalloProgramacionNativo.fromMap -- the single place native key
names appear -- and the fixtures build through that same constructor.
This commit is contained in:
2026-07-31 23:27:45 +02:00
parent a8dca83cd9
commit f2528c930b
4 changed files with 39 additions and 28 deletions
+2 -2
View File
@@ -198,7 +198,7 @@ class FakePuertoAlarmasAndroid implements PuertoAlarmasAndroid {
/// Native-recorded failures the next read should return. Tests seed this
/// to simulate a pre-notice that never armed, a refused foreground-service
/// start, or a per-alarm reschedule that failed after a reboot.
List<Map<String, Object?>> fallosNativos = const [];
List<FalloProgramacionNativo> fallosNativos = const [];
int lecturasFallosNativos = 0;
@@ -206,7 +206,7 @@ class FakePuertoAlarmasAndroid implements PuertoAlarmasAndroid {
bool fallaLecturaFallosNativos = false;
@override
Future<List<Map<String, Object?>>> fallosNativosProgramacion() async {
Future<List<FalloProgramacionNativo>> fallosNativosProgramacion() async {
lecturasFallosNativos++;
if (fallaLecturaFallosNativos) {
throw StateError('canal no disponible');