import 'package:flutter_test/flutter_test.dart'; import 'package:yumi/shared/data_sources/sources/local/floating_screen_manager.dart'; void main() { group('floating screen allowed routes', () { test('allows home and message tabs only on the root route', () { expect(isFloatingAllowedRouteName('/', rootTabAllowed: true), isTrue); expect(isFloatingAllowedRouteName('/', rootTabAllowed: false), isFalse); }); test('allows message, message details, and room routes', () { for (final route in const [ '/main/messagePage', '/chat?conversation=test', '/systemChat', '/room', ]) { expect( isFloatingAllowedRouteName(route, rootTabAllowed: false), isTrue, reason: route, ); } }); test('rejects unrelated and room child routes', () { for (final route in const [ '/main/person', '/main/language', '/room/rocket/rank', '/chat/activity', ]) { expect( isFloatingAllowedRouteName(route, rootTabAllowed: true), isFalse, reason: route, ); } }); }); test( 'only a left swipe beyond the threshold dismisses a floating screen', () { expect(shouldDismissFloatingForLeftSwipe(-72), isTrue); expect(shouldDismissFloatingForLeftSwipe(-120), isTrue); expect(shouldDismissFloatingForLeftSwipe(-71), isFalse); expect(shouldDismissFloatingForLeftSwipe(120), isFalse); }, ); }