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.
This commit is contained in:
@@ -1,9 +1,12 @@
|
|||||||
import 'package:flutter_test/flutter_test.dart';
|
import 'package:flutter_test/flutter_test.dart';
|
||||||
import 'package:farolero/estado/estado_juego.dart';
|
import 'package:farolero/estado/estado_juego.dart';
|
||||||
import 'package:farolero/modelos/partida.dart';
|
import 'package:farolero/modelos/partida.dart';
|
||||||
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
TestWidgetsFlutterBinding.ensureInitialized();
|
TestWidgetsFlutterBinding.ensureInitialized();
|
||||||
|
// crearPartida limpia las notas, y eso pasa por SharedPreferences.
|
||||||
|
setUp(() => SharedPreferences.setMockInitialValues({}));
|
||||||
|
|
||||||
group('EstadoJuego crearPartida with host local', () {
|
group('EstadoJuego crearPartida with host local', () {
|
||||||
late EstadoJuego estado;
|
late EstadoJuego estado;
|
||||||
|
|||||||
@@ -12,9 +12,6 @@ void main() {
|
|||||||
servicio = ServicioNearby();
|
servicio = ServicioNearby();
|
||||||
});
|
});
|
||||||
|
|
||||||
tearDown(() {
|
|
||||||
servicio.dispose();
|
|
||||||
});
|
|
||||||
|
|
||||||
test('should start with empty user pool', () {
|
test('should start with empty user pool', () {
|
||||||
expect(servicio.usuarios, isEmpty);
|
expect(servicio.usuarios, isEmpty);
|
||||||
|
|||||||
Reference in New Issue
Block a user