import 'package:flutter_test/flutter_test.dart'; import 'package:marianum_mobile/push/push_registration.dart'; void main() { group('PushRegistration.endpointChanged', () { const live = 'https://connect.marianum-fulda.de/push-proxy/'; const beta = 'https://connect-beta.marianum-fulda.de/push-proxy/'; test('different registered endpoint forces re-registration', () { expect( PushRegistration.endpointChanged(registered: live, current: beta), isTrue, ); }); test('matching endpoint does not force re-registration', () { expect( PushRegistration.endpointChanged(registered: live, current: live), isFalse, ); }); test('missing stored endpoint (pre-tracking install) does not force', () { expect( PushRegistration.endpointChanged(registered: null, current: live), isFalse, ); expect( PushRegistration.endpointChanged(registered: '', current: live), isFalse, ); }); test('nextcloud base URL change is detected the same way', () { expect( PushRegistration.endpointChanged( registered: 'https://cloud.marianum-fulda.de', current: 'https://mhsl.eu/marianum/marianummobile/cloud', ), isTrue, ); }); }); }