refactor(iap): make esPremium a required constructor parameter
EstadoAlarmas, EstadoGrabacion and EstadoRadio defaulted `esPremium` to `() => true`, so any construction site that forgot to wire entitlement compiled fine and silently ran ungated — failing OPEN to premium and disabling the paywall with no test able to catch it. The parameter is now required with no default. Production wiring in app.dart was already correct and is unchanged; the 184 pre-existing test call sites now pass `() => true` explicitly, which is exactly the old implicit default, so every assertion is untouched. EstadoRadio has no gate of its own but constructs EstadoGrabacion, so it inherits the same contract. The one test that existed to pin the old default is renamed to describe what it still covers (the premium path through iniciar() with no duracion); its assertions are unchanged.
This commit is contained in:
@@ -12,7 +12,7 @@ import '../helpers/fakes.dart';
|
||||
void main() {
|
||||
test('notifica listeners cuando cambia el estado de grabación', () async {
|
||||
final servicio = _ServicioGrabacionControlado();
|
||||
final estado = EstadoGrabacion(servicio: servicio);
|
||||
final estado = EstadoGrabacion(esPremium: () => true, servicio: servicio);
|
||||
addTearDown(estado.dispose);
|
||||
|
||||
var notificaciones = 0;
|
||||
@@ -36,6 +36,7 @@ void main() {
|
||||
final servicio = _ServicioGrabacionControlado();
|
||||
final emisora = emisoraDemo(uuid: 'rec-2', nombre: 'Actual');
|
||||
final estado = EstadoGrabacion(
|
||||
esPremium: () => true,
|
||||
servicio: servicio,
|
||||
emisoraActual: () => emisora,
|
||||
);
|
||||
@@ -54,6 +55,7 @@ void main() {
|
||||
final servicio = _ServicioGrabacionControlado();
|
||||
final errores = <String>[];
|
||||
final estado = EstadoGrabacion(
|
||||
esPremium: () => true,
|
||||
servicio: servicio,
|
||||
emisoraActual: () => null,
|
||||
alError: errores.add,
|
||||
@@ -70,7 +72,11 @@ void main() {
|
||||
test('un estado de error del servicio se reporta vía alError', () async {
|
||||
final servicio = _ServicioGrabacionControlado();
|
||||
final errores = <String>[];
|
||||
final estado = EstadoGrabacion(servicio: servicio, alError: errores.add);
|
||||
final estado = EstadoGrabacion(
|
||||
servicio: servicio,
|
||||
alError: errores.add,
|
||||
esPremium: () => true,
|
||||
);
|
||||
addTearDown(estado.dispose);
|
||||
|
||||
servicio.emitir(
|
||||
|
||||
Reference in New Issue
Block a user