import 'package:flutter_test/flutter_test.dart'; import 'package:pluriwave/servicios/servicio_audio.dart'; /// Android Auto play-path backstop (design.md ADR-4, android-auto-media /// spec "Free-Tier Browse Never Leaks Real Content" + "Current-Station /// Playback Unaffected By Free Tier"): `playFromMediaId`, `playFromSearch`, /// `skipToNext`, `skipToPrevious` must ALL no-op for a free-tier user, /// regardless of the target id — gating `getChildren` alone is /// insufficient because a head unit caches browse trees, so a stale /// `emisora:` tap could otherwise bypass browsing entirely. Pure — /// `PluriWaveAudioHandler` cannot be instantiated in a unit test (needs a /// real platform `AudioPlayer`), so this is the extracted decision the /// handler's dispatch methods delegate to (mirrors `mapearEstadoProceso` /// and every other pure helper in this file). void main() { test('free tier: bloquea cualquier cambio de emisora/salto', () { expect(debeBloquearCambioDeEmisora(premium: false), isTrue); }); test('premium: nunca bloquea', () { expect(debeBloquearCambioDeEmisora(premium: true), isFalse); }); group('notificarDesbloqueoAuto / registrarNotificacionDesbloqueoAuto', () { test('sin hook registrado, es un no-op seguro', () { expect(() => notificarDesbloqueoAuto(), returnsNormally); }); test('invoca el hook registrado exactamente una vez por llamada', () { var llamadas = 0; registrarNotificacionDesbloqueoAuto(() => llamadas++); notificarDesbloqueoAuto(); expect(llamadas, 1); }); }); }