import 'dart:io'; import 'package:flutter_test/flutter_test.dart'; /// Play production-readiness guard over the declared Android permissions. /// /// There is no Dart seam around `Geolocator` (it is a static facade, not an /// injectable port), so the only honest place to pin the permission surface /// is the manifest file itself. That is deliberate: the risk this guards is /// a *declaration* mismatch with the Data Safety form, which is a property /// of the manifest, not of any Dart call. void main() { late String manifiesto; setUpAll(() { manifiesto = File('android/app/src/main/AndroidManifest.xml').readAsStringSync(); }); bool declara(String permiso) => manifiesto.contains('android.permission.$permiso'); group('permisos de ubicacion', () { test('NO declara ACCESS_FINE_LOCATION: la app solo resuelve un codigo ISO ' 'de pais y el Data Safety enviado declara ubicacion aproximada', () { expect( declara('ACCESS_FINE_LOCATION'), isFalse, reason: 'The only location consumer is ' 'EstadoBusqueda.cargarEmisorasCercanas, which asks for ' 'LocationAccuracy.low and reduces the fix to ' 'Placemark.isoCountryCode. Declaring FINE contradicts the ' 'approved "approximate location" Data Safety declaration.', ); }); test('SI declara ACCESS_COARSE_LOCATION: sin ninguno de los dos, el ' 'plugin lanza PermissionUndefinedException', () { expect(declara('ACCESS_COARSE_LOCATION'), isTrue); }); }); }