import 'package:flutter_test/flutter_test.dart'; import 'package:in_app_purchase/in_app_purchase.dart'; import 'package:pluriwave/servicios/servicio_compras.dart'; /// Pure port-boundary tests (Design ADR-2 "keeps Strict TDD viable with zero /// plugin channels in unit tests"): [eventoDesdeEstadoCompra] is the ONLY /// piece of `ServicioComprasPlayBilling` that is unit-testable without a /// real `in_app_purchase` platform channel — [ServicioComprasPlayBilling] /// itself is the sole call site (Design ADR-2), exercised instead through /// `EstadoEntitlement` + a fake `PuertoCompras` /// (`estado_entitlement_test.dart`). void main() { group('eventoDesdeEstadoCompra', () { test('purchased -> comprada', () { expect( eventoDesdeEstadoCompra(PurchaseStatus.purchased).tipo, TipoEventoCompra.comprada, ); }); test('restored -> restaurada', () { expect( eventoDesdeEstadoCompra(PurchaseStatus.restored).tipo, TipoEventoCompra.restaurada, ); }); test('canceled -> cancelada', () { expect( eventoDesdeEstadoCompra(PurchaseStatus.canceled).tipo, TipoEventoCompra.cancelada, ); }); test('pending -> pendiente', () { expect( eventoDesdeEstadoCompra(PurchaseStatus.pending).tipo, TipoEventoCompra.pendiente, ); }); test('error conserva el mensaje diagnostico', () { final evento = eventoDesdeEstadoCompra( PurchaseStatus.error, mensaje: 'BILLING_UNAVAILABLE', ); expect(evento.tipo, TipoEventoCompra.error); expect(evento.mensaje, 'BILLING_UNAVAILABLE'); }); }); test('idProducto es el identificador unico no-consumible', () { expect(ServicioComprasPlayBilling.idProducto, 'pluriwave_premium'); }); }