feat(multi-device): host puede participar como jugador
- Añadido modelo Usuario con pool de usuarios sincronizado - El host ahora recibe palabra y rol como cualquier jugador - UI de selección de perfil en pantallas de lobby - Los clientes pueden ver usuarios del servidor o crear nuevos - El juego no inicia hasta que el host selecciona perfil
This commit is contained in:
37
test/usuario_test.dart
Normal file
37
test/usuario_test.dart
Normal file
@@ -0,0 +1,37 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:farolero/modelos/usuario.dart';
|
||||
|
||||
void main() {
|
||||
group('Usuario', () {
|
||||
test('should create Usuario with id and nombre', () {
|
||||
final usuario = Usuario(id: 'test-id', nombre: 'Juan');
|
||||
|
||||
expect(usuario.id, 'test-id');
|
||||
expect(usuario.nombre, 'Juan');
|
||||
});
|
||||
|
||||
test('should serialize to JSON correctly', () {
|
||||
final usuario = Usuario(id: 'test-id', nombre: 'Juan');
|
||||
final json = usuario.toJson();
|
||||
|
||||
expect(json['id'], 'test-id');
|
||||
expect(json['nombre'], 'Juan');
|
||||
});
|
||||
|
||||
test('should deserialize from JSON correctly', () {
|
||||
final json = {'id': 'test-id', 'nombre': 'Juan'};
|
||||
final usuario = Usuario.fromJson(json);
|
||||
|
||||
expect(usuario.id, 'test-id');
|
||||
expect(usuario.nombre, 'Juan');
|
||||
});
|
||||
|
||||
test('should handle JSON with avatar field', () {
|
||||
final json = {'id': 'test-id', 'nombre': 'Juan', 'avatar': '👤'};
|
||||
final usuario = Usuario.fromJson(json);
|
||||
|
||||
expect(usuario.id, 'test-id');
|
||||
expect(usuario.nombre, 'Juan');
|
||||
});
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user