refactor: cleanup dead code from reminder system
- Remove permission fallback logic from LocalNotificationService - Remove unused methods: _scheduleInApp*, _trackFallback, bindInAppReminderHandler - Remove unused fields: _permissionFallbackTracker, _inAppReminderHandler, _inAppFallbackTimersByEventId, _canDeliverSystemNotification - Remove unused _showSnoozeOptions from ReminderOverlay - Remove unused reminderActionExecutor from AuthSessionBootstrapper - Remove obsolete test files: reminder_permission_fallback_test, reminder_notification_bridge_test, auth_session_bootstrapper_test - Add native notification grouping (threadIdentifier/groupKey)
This commit is contained in:
@@ -1,58 +0,0 @@
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mocktail/mocktail.dart';
|
||||
import 'package:social_app/core/notifications/local_notification_service.dart';
|
||||
import 'package:social_app/core/startup/auth_session_bootstrapper.dart';
|
||||
import 'package:social_app/features/auth/presentation/bloc/auth_state.dart';
|
||||
import 'package:social_app/features/calendar/data/services/calendar_service.dart';
|
||||
import 'package:social_app/features/calendar/reminders/reminder_action_executor.dart';
|
||||
|
||||
class MockCalendarService extends Mock implements CalendarService {}
|
||||
|
||||
class MockLocalNotificationService extends Mock
|
||||
implements LocalNotificationService {}
|
||||
|
||||
class MockReminderActionExecutor extends Mock
|
||||
implements ReminderActionExecutor {}
|
||||
|
||||
void main() {
|
||||
late MockCalendarService calendarService;
|
||||
late MockLocalNotificationService notificationService;
|
||||
late MockReminderActionExecutor reminderActionExecutor;
|
||||
late AuthSessionBootstrapper bootstrapper;
|
||||
|
||||
setUp(() {
|
||||
calendarService = MockCalendarService();
|
||||
notificationService = MockLocalNotificationService();
|
||||
reminderActionExecutor = MockReminderActionExecutor();
|
||||
bootstrapper = AuthSessionBootstrapper(
|
||||
calendarService: calendarService,
|
||||
notificationService: notificationService,
|
||||
reminderActionExecutor: reminderActionExecutor,
|
||||
);
|
||||
});
|
||||
|
||||
test('does not fetch calendar events for unauthenticated state', () async {
|
||||
await bootstrapper.syncForAuthState(AuthUnauthenticated());
|
||||
|
||||
verifyNever(() => calendarService.getEventsForRange(any(), any()));
|
||||
verifyNever(() => notificationService.rebuildUpcomingReminders(any()));
|
||||
});
|
||||
|
||||
test('fetches upcoming events after authenticated state', () async {
|
||||
when(
|
||||
() => calendarService.getEventsForRange(any(), any()),
|
||||
).thenAnswer((_) async => []);
|
||||
when(
|
||||
() => notificationService.rebuildUpcomingReminders(any()),
|
||||
).thenAnswer((_) async {});
|
||||
|
||||
await bootstrapper.syncForAuthState(
|
||||
const AuthAuthenticated(
|
||||
user: AuthUser(id: 'u1', phone: 'a@test.com'),
|
||||
),
|
||||
);
|
||||
|
||||
verify(() => calendarService.getEventsForRange(any(), any())).called(1);
|
||||
verify(() => notificationService.rebuildUpcomingReminders(any())).called(1);
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user