NUEVA GESTIÓN DE USUARIOS Y PARTIDAS
This commit is contained in:
34
test/servicio_historial_partidas_test.dart
Normal file
34
test/servicio_historial_partidas_test.dart
Normal file
@@ -0,0 +1,34 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:farolero/modelos/jugador.dart';
|
||||
import 'package:farolero/modelos/snapshot_partida_online.dart';
|
||||
import 'package:farolero/servicios/servicio_historial_partidas.dart';
|
||||
|
||||
void main() {
|
||||
test('crea resumen de historial desde snapshot online final', () {
|
||||
final snapshot = SnapshotPartidaOnline(
|
||||
roomId: 'room-1',
|
||||
fase: 'finPartida',
|
||||
ronda: 2,
|
||||
categoria: 'animales',
|
||||
palabraSecreta: 'León',
|
||||
ganador: 'jugadores',
|
||||
jugadores: [
|
||||
Jugador(id: 'j1', nombre: 'Ana'),
|
||||
Jugador(id: 'j2', nombre: 'Bruno', esImpostor: true),
|
||||
Jugador(id: 'j3', nombre: 'Clara'),
|
||||
],
|
||||
impostores: ['Bruno'],
|
||||
);
|
||||
|
||||
final guardado = ResultadoPartidaGuardado.desdeSnapshotOnline(snapshot);
|
||||
|
||||
expect(guardado.id, 'online-room-1');
|
||||
expect(guardado.modoMultimovil, isTrue);
|
||||
expect(guardado.jugadores, 3);
|
||||
expect(guardado.impostores, 1);
|
||||
expect(guardado.rondas, 2);
|
||||
expect(guardado.ganador, 'jugadores');
|
||||
expect(guardado.palabra, 'León');
|
||||
expect(guardado.categoria, 'animales');
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user