import 'package:eatvio_app/core/theme/theme_helper.dart'; import 'package:eatvio_app/features/notifications/models/notification_model.dart'; import 'package:eatvio_app/features/notifications/presentation/widgets/notification_widget.dart'; import 'package:eatvio_app/generated/l10n.dart'; import 'package:flutter/material.dart'; import 'package:flutter_test/flutter_test.dart'; import 'package:flutter_localizations/flutter_localizations.dart'; void main() { group('NotificationWidget', () { final testDate = DateTime(2024, 1, 15, 10, 30); Widget createTestWidget(BaseNotificationModel notification) { return MaterialApp( localizationsDelegates: const [ S.delegate, GlobalMaterialLocalizations.delegate, GlobalWidgetsLocalizations.delegate, GlobalCupertinoLocalizations.delegate, ], supportedLocales: const [Locale('ru'), Locale('en')], locale: const Locale('ru'), theme: ThemeHelper().themeData(), home: Scaffold( body: NotificationWidget(notification: notification), ), ); } testWidgets('displays PlanSubscriptionStartedToAuthorNotification', (tester) async { final notification = PlanSubscriptionStartedToAuthorNotification( type: NotificationType.planSubscriptionStartedToAuthor, planName: 'Test Plan', planId: 1, customerName: 'Test Customer', userId: 0, userPhotoPath: '', chatId: 'chat123', chatUrl: '', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays PlanSubscriptionCanceledToAuthorNotification', (tester) async { final notification = PlanSubscriptionCanceledToAuthorNotification( type: NotificationType.planSubscriptionCanceledToAuthor, planName: 'Test Plan', planId: 1, customerName: 'Test Customer', userId: 0, userPhotoPath: '', chatUrl: '', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays ChosenPlanStartedToClientNotification', (tester) async { final notification = ChosenPlanStartedToClientNotification( type: NotificationType.chosenPlanStartedToClient, planName: 'Test Plan', planId: 1, consultantName: 'Test Consultant', peerProfileUrl: '', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays ChosenPlanTomorrowReminderToClientNotification', (tester) async { final notification = ChosenPlanTomorrowReminderToClientNotification( type: NotificationType.chosenPlanTomorrowReminderToClient, planName: 'Test Plan', consultantName: '', chatId: 0, isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays DiaryReminderNotification', (tester) async { final notification = DiaryReminderNotification( type: NotificationType.diaryReminderNotification, isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays ConsultantLeftCommentNotification', (tester) async { final notification = ConsultantLeftCommentNotification( type: NotificationType.consultantLeftComment, chosenPlanId: 1, diaryId: 0, date: testDate, planName: '', userName: '', consultantName: '', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays PersonalizedDietIsDefinedNotification', (tester) async { final notification = PersonalizedDietIsDefinedNotification( type: NotificationType.personalizedDietIsDefined, isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays ChosenPlanFinishedToClientNotification', (tester) async { final notification = ChosenPlanFinishedToClientNotification( type: NotificationType.chosenPlanFinishedToClient, planName: 'Test Plan', chosenPlanId: 1, consultantName: '', consultantPhotoPath: '', consultantProfileUrl: '', consultantId: 0, isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays PlanSubscriptionCanceledToCustomerNotification', (tester) async { final notification = PlanSubscriptionCanceledToCustomerNotification( type: NotificationType.planSubscriptionCanceledToCustomer, planName: 'Test Plan', planId: 1, authorName: '', authorId: 0, authorPhotoPath: '', chatUrl: '', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays ChosenPlanStartedToConsultantNotification', (tester) async { final notification = ChosenPlanStartedToConsultantNotification( type: NotificationType.chosenPlanStartedToConsultant, planName: 'Test Plan', customerName: 'Test Customer', planId: 1, customerId: 1, peerProfileUrl: '', consultationUrl: '', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays ChosenPlanTomorrowReminderToConsultantNotification', (tester) async { final notification = ChosenPlanTomorrowReminderToConsultantNotification( type: NotificationType.chosenPlanTomorrowReminderToConsultant, planName: 'Test Plan', customerName: 'Test Customer', chatId: 0, isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays PlanSubscriptionPaidToAuthorNotification', (tester) async { final notification = PlanSubscriptionPaidToAuthorNotification( type: NotificationType.planSubscriptionPaidToAuthor, planName: 'Test Plan', planId: 1, customerName: 'Test Customer', userId: 0, userPhotoPath: '', chatUrl: '', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays ChosenPlanFinishedToConsultantNotification with button', (tester) async { final notification = ChosenPlanFinishedToConsultantNotification( type: NotificationType.chosenPlanFinishedToConsultant, planName: 'Test Plan', customerName: 'Test Customer', planId: 1, chosenPlanId: 1, clientPhotoPath: '', clientId: 0, isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays ChosenPlanLastDayFinishedForUser', (tester) async { final notification = ChosenPlanLastDayFinishedForUser( type: NotificationType.chosenPlanLastDayFinishedForUser, planName: 'Test Plan', chosenPlanId: 1, complaintUrl: '', chatUrl: '', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays ChosenPlanConsultantLastDayStarted', (tester) async { final notification = ChosenPlanConsultantLastDayStarted( type: NotificationType.chosenPlanConsultantLastDayStarted, planName: 'Test Plan', planId: 1, chatId: 'chat123', chatUrl: 'chat_url', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays ComplaintToModerationForUser', (tester) async { final notification = ComplaintToModerationForUser( type: NotificationType.complaintToModerationForUser, message: 'Test message', entityId: 1, entityType: 'test', entityName: 'Test Entity', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays CommentReplied', (tester) async { final notification = CommentReplied( type: NotificationType.commentReplied, entityName: 'Test Entity', commentedEntityId: 1, commentedEntityType: CommentedEntityType.diet, author: 'Test Author', authorId: 1, parentCommentId: 1, isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays ScoreAdded', (tester) async { final notification = ScoreAdded( type: NotificationType.scoreAdded, scoreKey: 'test_key', scorableId: 1, scorableType: 'test', scorableName: 'Test Name', scorableSlug: 'test-slug', scoreValue: 10, isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays EntityCommented', (tester) async { final notification = EntityCommented( type: NotificationType.entityCommented, entityName: 'Test Entity', entityId: 1, entityType: CommentedEntityType.diet, entityTranslatedType: 'Test Type', entityUrl: 'test_url', authorName: 'Test Author', authorId: 1, authorSlug: 'test-author', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays PlanSubscriptionExpiredNotification', (tester) async { final notification = PlanSubscriptionExpiredNotification( type: NotificationType.planSubscriptionExpired, planName: 'Test Plan', customerName: 'Test Customer', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays PlanSubscriptionRenewedNotification', (tester) async { final notification = PlanSubscriptionRenewedNotification( type: NotificationType.planSubscriptionRenewed, planName: 'Test Plan', customerName: 'Test Customer', renewalDate: '2024-02-01', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays ConsultantAssignedNotification', (tester) async { final notification = ConsultantAssignedNotification( type: NotificationType.consultantAssigned, consultantName: 'Test Consultant', planName: 'Test Plan', planId: 1, isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays ConsultantUnassignedNotification', (tester) async { final notification = ConsultantUnassignedNotification( type: NotificationType.consultantUnassigned, consultantName: 'Test Consultant', planName: 'Test Plan', planId: 1, isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays PaymentFailedNotification', (tester) async { final notification = PaymentFailedNotification( type: NotificationType.paymentFailed, planName: 'Test Plan', errorMessage: 'Test error', paymentMethod: 'card', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays PaymentSuccessfulNotification', (tester) async { final notification = PaymentSuccessfulNotification( type: NotificationType.paymentSuccessful, planName: 'Test Plan', amount: 100.0, currency: 'USD', transactionId: 'trans123', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays GoalAchievedNotification', (tester) async { final notification = GoalAchievedNotification( type: NotificationType.goalAchieved, goalName: 'Test Goal', goalType: 'weight', achievedValue: 50.0, targetValue: 100.0, isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays WorkoutReminderNotification', (tester) async { final notification = WorkoutReminderNotification( type: NotificationType.workoutReminder, workoutName: 'Test Workout', workoutType: 'cardio', duration: 30, isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays MealReminderNotification', (tester) async { final notification = MealReminderNotification( type: NotificationType.mealReminder, mealName: 'Test Meal', mealType: 'breakfast', calories: 500, isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays DietCancelledNotification', (tester) async { final notification = DietCancelledNotification( type: NotificationType.dietCancelled, dietName: 'Test Diet', dietId: 1, isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays DietStartedNotification', (tester) async { final notification = DietStartedNotification( type: NotificationType.dietStarted, dietName: 'Test Diet', dietId: 1, isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays DietExpiredNotification', (tester) async { final notification = DietExpiredNotification( type: NotificationType.dietExpired, dietName: 'Test Diet', dietId: 1, isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays DietWillStartedInNotification', (tester) async { final notification = DietWillStartedInNotification( type: NotificationType.dietWillStartedIn, dietName: 'Test Diet', dietId: 1, startDate: '2024-02-01', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays DietCanNotBeStartedNotification', (tester) async { final notification = DietCanNotBeStartedNotification( type: NotificationType.dietCanNotBeStarted, dietName: 'Test Diet', dietId: 1, reason: 'Test reason', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays PersonalDietCreationNeededNotification', (tester) async { final notification = PersonalDietCreationNeededNotification( type: NotificationType.personalDietCreationNeeded, userName: 'Test Client', consultantName: '', myDietsUrl: '', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays ChosenPlanClientLastDayFinishedNotification', (tester) async { final notification = ChosenPlanClientLastDayFinishedNotification( type: NotificationType.chosenPlanClientLastDayFinished, planName: 'Test Plan', chosenPlanId: 1, complaintUrl: '', chatUrl: '', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays ChosenPlanClientLastDayStartedNotification', (tester) async { final notification = ChosenPlanClientLastDayStartedNotification( type: NotificationType.chosenPlanClientLastDayStarted, planName: 'Test Plan', chosenPlanId: 1, lastDayDiaryUrl: '', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays StayOnTrackToAuthorNotification', (tester) async { final notification = StayOnTrackToAuthorNotification( type: NotificationType.stayOnTrackToAuthor, planName: 'Test Plan', userName: 'Test Client', dayNum: 1, diaryDayId: 0, isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays ClientStartPlanSubscriptionToSubscriberNotification', (tester) async { final notification = ClientStartPlanSubscriptionToSubscriberNotification( type: NotificationType.clientStartPlanSubscriptionToSubscriber, planName: 'Test Plan', planId: 1, authorName: '', authorId: 0, authorPhotoPath: '', chatUrl: '', chatId: '', startDate: '', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays ConsultantConfirmPlanSubscriptionToSubscriberNotification', (tester) async { final notification = ConsultantConfirmPlanSubscriptionToSubscriberNotification( type: NotificationType.consultantConfirmPlanSubscriptionToSubscriber, planName: 'Test Plan', planId: 1, consultantName: 'Test Consultant', authorId: 0, authorPhotoPath: '', chatUrl: '', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays ClientPaidPlanSubscriptionToAuthorNotification', (tester) async { final notification = ClientPaidPlanSubscriptionToAuthorNotification( type: NotificationType.clientPaidPlanSubscriptionToAuthor, planName: 'Test Plan', planId: 1, clientName: 'Test Client', userId: 0, userPhotoPath: '', chatUrl: '', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays ConsultantLeftDiaryCommentNotification', (tester) async { final notification = ConsultantLeftDiaryCommentNotification( type: NotificationType.consultantLeftDiaryComment, chosenPlanId: 1, diaryId: 0, planName: 'Test Plan', userName: '', consultantName: 'Test Consultant', diaryDate: testDate, isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays ConsultantConfirmPlanSubscriptionToAuthorNotification', (tester) async { final notification = ConsultantConfirmPlanSubscriptionToAuthorNotification( type: NotificationType.consultantConfirmPlanSubscriptionToAuthor, planName: 'Test Plan', planId: 1, clientName: 'Test Consultant', userId: 0, userPhotoPath: '', chatUrl: '', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays ClientPaidPlanSubscriptionToSubscriberNotification', (tester) async { final notification = ClientPaidPlanSubscriptionToSubscriberNotification( type: NotificationType.clientPaidPlanSubscriptionToSubscriber, planName: 'Test Plan', planId: 1, authorName: '', authorId: 0, authorPhotoPath: '', chatUrl: '', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays ClientStartPlanSubscriptionToAuthorNotification', (tester) async { final notification = ClientStartPlanSubscriptionToAuthorNotification( type: NotificationType.clientStartPlanSubscriptionToAuthor, planName: 'Test Plan', planId: 1, clientName: 'Test Client', userId: 0, userPhotoPath: '', chatId: '', chatUrl: '', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays ClientCancelPlanSubscriptionToAuthorNotification', (tester) async { final notification = ClientCancelPlanSubscriptionToAuthorNotification( type: NotificationType.clientCancelPlanSubscriptionToAuthor, planName: 'Test Plan', planId: 1, clientName: 'Test Client', userId: 0, userPhotoPath: '', chatUrl: '', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays ClientCancelPlanSubscriptionToSubscriberNotification', (tester) async { final notification = ClientCancelPlanSubscriptionToSubscriberNotification( type: NotificationType.clientCancelPlanSubscriptionToSubscriber, planName: 'Test Plan', planId: 1, authorName: '', authorId: 0, authorPhotoPath: '', chatUrl: '', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays UserDailyReportCompletedNotification', (tester) async { final notification = UserDailyReportCompletedNotification( type: NotificationType.userDailyReportCompleted, chosenPlanId: 1, diaryId: 0, planName: 'Test Plan', clientName: 'Test Client', consultantName: '', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays StayOnTrackToCustomerNotification', (tester) async { final notification = StayOnTrackToCustomerNotification( type: NotificationType.stayOnTrackToCustomer, planName: 'Test Plan', dayNum: 1, diaryDayId: 0, isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays PhoneChangedNotification', (tester) async { final notification = PhoneChangedNotification( type: NotificationType.phoneChanged, oldPhone: '+1234567890', newPhone: '+0987654321', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays SubscriptionNotification', (tester) async { final notification = SubscriptionNotification( type: NotificationType.subscription, userName: '', userPhotoPath: '', userProfileUrl: '', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays BadgeAwardedNotification', (tester) async { final notification = BadgeAwardedNotification( type: NotificationType.badgeAwarded, badgeTitle: 'Test Badge', badgeType: '', badgeImage: '', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays BadgeRevokedNotification', (tester) async { final notification = BadgeRevokedNotification( type: NotificationType.badgeRevoked, badgeTitle: 'Test Badge', badgeType: '', badgeImage: '', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays ConsultantRequestStartedNotification', (tester) async { final notification = ConsultantRequestStartedNotification( type: NotificationType.consultantRequestStarted, consultantName: 'Test Consultant', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays ClientCloseComplaintSuccessNotification', (tester) async { final notification = ClientCloseComplaintSuccessNotification( type: NotificationType.clientCloseComplaintSuccess, planName: 'Test Plan', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays ClientRefundSuccessNotification', (tester) async { final notification = ClientRefundSuccessNotification( type: NotificationType.clientRefundSuccess, planName: 'Test Plan', amount: 100.0, reason: 'Test reason', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays ConsultantRefundSuccessNotification', (tester) async { final notification = ConsultantRefundSuccessNotification( type: NotificationType.consultantRefundSuccess, planName: 'Test Plan', clientName: 'Test Client', amount: 100.0, isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays ClientRejectSuccessNotification', (tester) async { final notification = ClientRejectSuccessNotification( type: NotificationType.clientRejectSuccess, planName: 'Test Plan', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays ConsultantRejectSuccessNotification', (tester) async { final notification = ConsultantRejectSuccessNotification( type: NotificationType.consultantRejectSuccess, planName: 'Test Plan', clientName: 'Test Client', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays ScoreSubstractedNotification', (tester) async { final notification = ScoreSubstractedNotification( type: NotificationType.scoreSubstracted, scoreKey: 'test_key', scorableId: 1, scorableType: 'test', scorableName: 'Test Name', scorableSlug: 'test-slug', scoreValue: 10, isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays ProductStatusUpdatedForAuthorNotification', (tester) async { final notification = ProductStatusUpdatedForAuthorNotification( type: NotificationType.productStatusUpdatedForAuthor, productName: 'Test Product', productId: 1, author: '', authorId: 0, status: 'approved', subject: '', messageLine: '', isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays DiaryReminderForUsersNotification', (tester) async { final notification = DiaryReminderForUsersNotification( type: NotificationType.diaryReminderForUsers, isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays PersonalDietIsDefinedToCustomerNotification', (tester) async { final notification = PersonalDietIsDefinedToCustomerNotification( type: NotificationType.personalDietIsDefinedToCustomer, isRead: false, createdAt: testDate, chosenPlanId: 1, dietId: 1, planName: '', userName: '', consultantName: '', dietName: 'Test Diet', role: '', peerSlug: '', peerImagePath: '', ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('displays UnknownNotification', (tester) async { final notification = UnknownNotification( type: NotificationType.unknown, isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); testWidgets('shows unread indicator when isRead is false', (tester) async { final notification = DiaryReminderNotification( type: NotificationType.diaryReminderNotification, isRead: false, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); // Check for unread indicator (blue circle) expect(find.byType(Container), findsWidgets); }); testWidgets('hides unread indicator when isRead is true', (tester) async { final notification = DiaryReminderNotification( type: NotificationType.diaryReminderNotification, isRead: true, createdAt: testDate, ); await tester.pumpWidget(createTestWidget(notification)); await tester.pumpAndSettle(); expect(find.byType(NotificationWidget), findsOneWidget); }); }); }