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:
@@ -8,11 +8,10 @@ import '../helpers/fakes_alarmas.dart';
|
||||
|
||||
/// Freemium gating (freemium-gating spec, design ADR-3/ADR-5): the 5-alarm
|
||||
/// cap for free-tier users, grandfathering of pre-existing alarms, and the
|
||||
/// full premium gate on vacation-range creation. `EstadoAlarmas`'s existing
|
||||
/// suite constructs it with NO `esPremium` callback and expects unrestricted
|
||||
/// behavior — the default therefore stays `() => true` (ungated) so every
|
||||
/// one of those tests keeps passing unchanged; only tests here explicitly
|
||||
/// inject `esPremium: () => false` to exercise the free tier.
|
||||
/// full premium gate on vacation-range creation. `esPremium` is a REQUIRED
|
||||
/// constructor parameter with no default — every other suite passes
|
||||
/// `() => true` explicitly to keep its pre-gate behavior, and the tests here
|
||||
/// inject `() => false` to exercise the free tier.
|
||||
AlarmaMusical _alarma(String id, {bool activa = true}) => AlarmaMusical(
|
||||
id: id,
|
||||
nombre: 'Alarma $id',
|
||||
|
||||
Reference in New Issue
Block a user