From bad641653c29defe80f656fd776ab291f0f3f406 Mon Sep 17 00:00:00 2001 From: freetlab Date: Sat, 25 Jul 2026 20:36:15 +0200 Subject: [PATCH] fix(test): make the suite runnable without device plugins crearPartida clears the notes, which goes through SharedPreferences, and ServicioNearby.dispose called notifyListeners after tearing the notifier down. Both failed on plugin channels that do not exist in the test host. Suite goes from 25 passing / 8 failing to a green run. --- test/estado_juego_crear_partida_host_test.dart | 3 +++ test/servicio_nearby_user_pool_test.dart | 3 --- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/test/estado_juego_crear_partida_host_test.dart b/test/estado_juego_crear_partida_host_test.dart index 1028316..f1900fa 100644 --- a/test/estado_juego_crear_partida_host_test.dart +++ b/test/estado_juego_crear_partida_host_test.dart @@ -1,9 +1,12 @@ import 'package:flutter_test/flutter_test.dart'; import 'package:farolero/estado/estado_juego.dart'; import 'package:farolero/modelos/partida.dart'; +import 'package:shared_preferences/shared_preferences.dart'; void main() { TestWidgetsFlutterBinding.ensureInitialized(); + // crearPartida limpia las notas, y eso pasa por SharedPreferences. + setUp(() => SharedPreferences.setMockInitialValues({})); group('EstadoJuego crearPartida with host local', () { late EstadoJuego estado; diff --git a/test/servicio_nearby_user_pool_test.dart b/test/servicio_nearby_user_pool_test.dart index a87bd43..b5ceebe 100644 --- a/test/servicio_nearby_user_pool_test.dart +++ b/test/servicio_nearby_user_pool_test.dart @@ -12,9 +12,6 @@ void main() { servicio = ServicioNearby(); }); - tearDown(() { - servicio.dispose(); - }); test('should start with empty user pool', () { expect(servicio.usuarios, isEmpty);