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:
@@ -49,10 +49,14 @@ void main() {
|
||||
expect(servicio.inicios, 1);
|
||||
});
|
||||
|
||||
test('sin callback de entitlement, el default no bloquea (compat)', () async {
|
||||
// `esPremium` is a required parameter, so "no entitlement callback" is no
|
||||
// longer a reachable state to test; what stays worth covering is the
|
||||
// premium path through `iniciar()` with no explicit `duracion`.
|
||||
test('premium: iniciar() sin duracion tambien delega', () async {
|
||||
final servicio = _ServicioGrabacionControlado();
|
||||
final emisora = emisoraDemo(uuid: 'rec-3', nombre: 'Grabable');
|
||||
final estado = EstadoGrabacion(
|
||||
esPremium: () => true,
|
||||
servicio: servicio,
|
||||
emisoraActual: () => emisora,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user