feat: servicios WhatsApp, Bitácora WebControl, SQLite v4, UI y store listing
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:seguridad_electronica/services/sincronizador.dart';
|
||||
import 'package:seguridad_electronica/services/api_auth_service.dart';
|
||||
import 'package:seguridad_electronica/db/dao/alarmas_dao.dart';
|
||||
import 'package:sqflite_common_ffi/sqflite_ffi.dart';
|
||||
import 'package:shared_preferences/shared_preferences.dart';
|
||||
|
||||
void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
sqfliteFfiInit();
|
||||
databaseFactory = databaseFactoryFfi;
|
||||
SharedPreferences.setMockInitialValues({});
|
||||
|
||||
test('Prueba de sincronización real contra API_CENTINEL_SECURITY', () async {
|
||||
// 1. Precargar credenciales de Centinel
|
||||
await ApiAuthService.instance.usarCredencialesPruebaCentinel();
|
||||
final headers = await ApiAuthService.instance.getCentinelHeaders();
|
||||
print('Headers configurados: $headers');
|
||||
expect(headers != null, true);
|
||||
|
||||
// 2. Ejecutar pull de alarmas desde API
|
||||
await Sincronizador.instance.sincronizarAlarmas();
|
||||
|
||||
// 3. Verificar que se persistieron en SQLite
|
||||
final alarmas = await AlarmasDao().getAll();
|
||||
print('Total de alarmas en SQLite tras sincronización: ${alarmas.length}');
|
||||
for (final a in alarmas) {
|
||||
print(' - ID ${a.id}: severidad=${a.severidad}, estado=${a.estado}, notas=${a.notas}');
|
||||
}
|
||||
expect(alarmas.isNotEmpty, true);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user