forked from eatvio/eatvio_app
feat(tests): fixed notifications tests
This commit is contained in:
@@ -88,7 +88,7 @@ void main() {
|
||||
when(diaryCubit.state).thenReturn(const DiaryState.loading());
|
||||
when(diaryCubit.stream).thenAnswer((_) => const Stream<DiaryState>.empty());
|
||||
when(diaryCubit.close()).thenAnswer((_) async => Future<void>.value());
|
||||
when(diaryCubit.fetchDiaryV2(needLoading: anyNamed('needLoading'), diaryId: anyNamed('diaryId'))).thenAnswer((_) async => true);
|
||||
when(diaryCubit.fetchDiaryV2(needLoading: anyNamed('needLoading'), diaryId: anyNamed('diaryId'), date: anyNamed('date'))).thenAnswer((_) async => true);
|
||||
|
||||
final commentsCubit = MockConsultantCommentsCubit();
|
||||
when(commentsCubit.state).thenReturn(ConsultantCommentsState(commentsModel: ConsultantCommentModel(comment: '')));
|
||||
@@ -98,7 +98,7 @@ void main() {
|
||||
sl.registerFactory<DiaryCubit>(() => diaryCubit);
|
||||
sl.registerFactory<ConsultantCommentsCubit>(() => commentsCubit);
|
||||
|
||||
await tester.pumpWidget(wrap(const DiaryScreen()));
|
||||
await tester.pumpWidget(wrap(DiaryScreen(date: DateTime(2025, 1, 1))));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byType(DiaryScreen), findsOneWidget);
|
||||
@@ -109,7 +109,7 @@ void main() {
|
||||
when(diaryCubit.state).thenReturn(loadedState(hasChosenPlan: true));
|
||||
when(diaryCubit.stream).thenAnswer((_) => const Stream<DiaryState>.empty());
|
||||
when(diaryCubit.close()).thenAnswer((_) async => Future<void>.value());
|
||||
when(diaryCubit.fetchDiaryV2(needLoading: anyNamed('needLoading'), diaryId: anyNamed('diaryId'))).thenAnswer((_) async => true);
|
||||
when(diaryCubit.fetchDiaryV2(needLoading: anyNamed('needLoading'), diaryId: anyNamed('diaryId'), date: anyNamed('date'))).thenAnswer((_) async => true);
|
||||
|
||||
final commentsCubit = MockConsultantCommentsCubit();
|
||||
when(commentsCubit.state).thenReturn(ConsultantCommentsState(commentsModel: ConsultantCommentModel(comment: ''), dayCommentNeedsToBeFilled: false));
|
||||
@@ -119,7 +119,7 @@ void main() {
|
||||
sl.registerFactory<DiaryCubit>(() => diaryCubit);
|
||||
sl.registerFactory<ConsultantCommentsCubit>(() => commentsCubit);
|
||||
|
||||
await tester.pumpWidget(wrap(const DiaryScreen()));
|
||||
await tester.pumpWidget(wrap(DiaryScreen(date: DateTime(2025, 1, 1))));
|
||||
await tester.pumpAndSettle(const Duration(milliseconds: 300));
|
||||
|
||||
expect(find.byType(DiaryScreen), findsOneWidget);
|
||||
@@ -132,7 +132,7 @@ void main() {
|
||||
when(diaryCubit.state).thenReturn(const DiaryState.error(errorMessage: 'err'));
|
||||
when(diaryCubit.stream).thenAnswer((_) => const Stream<DiaryState>.empty());
|
||||
when(diaryCubit.close()).thenAnswer((_) async => Future<void>.value());
|
||||
when(diaryCubit.fetchDiaryV2(needLoading: anyNamed('needLoading'), diaryId: anyNamed('diaryId'))).thenAnswer((_) async => true);
|
||||
when(diaryCubit.fetchDiaryV2(needLoading: anyNamed('needLoading'), diaryId: anyNamed('diaryId'), date: anyNamed('date'))).thenAnswer((_) async => true);
|
||||
|
||||
final commentsCubit = MockConsultantCommentsCubit();
|
||||
when(commentsCubit.state).thenReturn(ConsultantCommentsState(commentsModel: ConsultantCommentModel(comment: '')));
|
||||
@@ -142,7 +142,7 @@ void main() {
|
||||
sl.registerFactory<DiaryCubit>(() => diaryCubit);
|
||||
sl.registerFactory<ConsultantCommentsCubit>(() => commentsCubit);
|
||||
|
||||
await tester.pumpWidget(wrap(const DiaryScreen()));
|
||||
await tester.pumpWidget(wrap(DiaryScreen(date: DateTime(2025, 1, 1))));
|
||||
await tester.pump();
|
||||
|
||||
expect(find.byType(DiaryScreen), findsOneWidget);
|
||||
@@ -161,7 +161,7 @@ void main() {
|
||||
when(diaryCubit.state).thenReturn(DiaryState.loadedTomorrowWithDiet(diary: futureDiary, selectedDay: DateTime(2025, 1, 2), selectedMeal: 1));
|
||||
when(diaryCubit.stream).thenAnswer((_) => const Stream<DiaryState>.empty());
|
||||
when(diaryCubit.close()).thenAnswer((_) async => Future<void>.value());
|
||||
when(diaryCubit.fetchDiaryV2(needLoading: anyNamed('needLoading'), diaryId: anyNamed('diaryId'))).thenAnswer((_) async => true);
|
||||
when(diaryCubit.fetchDiaryV2(needLoading: anyNamed('needLoading'), diaryId: anyNamed('diaryId'), date: anyNamed('date'))).thenAnswer((_) async => true);
|
||||
|
||||
final commentsCubit = MockConsultantCommentsCubit();
|
||||
when(commentsCubit.state).thenReturn(ConsultantCommentsState(commentsModel: ConsultantCommentModel(comment: '')));
|
||||
@@ -171,7 +171,7 @@ void main() {
|
||||
sl.registerFactory<DiaryCubit>(() => diaryCubit);
|
||||
sl.registerFactory<ConsultantCommentsCubit>(() => commentsCubit);
|
||||
|
||||
await tester.pumpWidget(wrap(const DiaryScreen()));
|
||||
await tester.pumpWidget(wrap(DiaryScreen(date: DateTime(2025, 1, 1))));
|
||||
await tester.pump(const Duration(milliseconds: 200));
|
||||
|
||||
expect(find.byType(DiaryScreen), findsOneWidget);
|
||||
@@ -193,7 +193,7 @@ void main() {
|
||||
when(diaryCubit.state).thenReturn(state);
|
||||
when(diaryCubit.stream).thenAnswer((_) => const Stream<DiaryState>.empty());
|
||||
when(diaryCubit.close()).thenAnswer((_) async => Future<void>.value());
|
||||
when(diaryCubit.fetchDiaryV2(needLoading: anyNamed('needLoading'), diaryId: anyNamed('diaryId'))).thenAnswer((_) async => true);
|
||||
when(diaryCubit.fetchDiaryV2(needLoading: anyNamed('needLoading'), diaryId: anyNamed('diaryId'), date: anyNamed('date'))).thenAnswer((_) async => true);
|
||||
|
||||
final commentsCubit = MockConsultantCommentsCubit();
|
||||
when(commentsCubit.state).thenReturn(ConsultantCommentsState(commentsModel: ConsultantCommentModel(comment: ''), dayCommentNeedsToBeFilled: false));
|
||||
@@ -204,7 +204,7 @@ void main() {
|
||||
sl.registerFactory<DiaryCubit>(() => diaryCubit);
|
||||
sl.registerFactory<ConsultantCommentsCubit>(() => commentsCubit);
|
||||
|
||||
await tester.pumpWidget(wrap(const DiaryScreen()));
|
||||
await tester.pumpWidget(wrap(DiaryScreen(date: DateTime(2025, 1, 1))));
|
||||
await tester.pump(const Duration(milliseconds: 200));
|
||||
|
||||
expect(find.text('Nice'), findsOneWidget);
|
||||
@@ -217,7 +217,7 @@ void main() {
|
||||
when(diaryCubit.state).thenReturn(state);
|
||||
when(diaryCubit.stream).thenAnswer((_) => const Stream<DiaryState>.empty());
|
||||
when(diaryCubit.close()).thenAnswer((_) async => Future<void>.value());
|
||||
when(diaryCubit.fetchDiaryV2(needLoading: anyNamed('needLoading'), diaryId: anyNamed('diaryId'))).thenAnswer((_) async => true);
|
||||
when(diaryCubit.fetchDiaryV2(needLoading: anyNamed('needLoading'), diaryId: anyNamed('diaryId'), date: anyNamed('date'))).thenAnswer((_) async => true);
|
||||
|
||||
final commentsCubit = MockConsultantCommentsCubit();
|
||||
when(commentsCubit.state).thenReturn(ConsultantCommentsState(commentsModel: ConsultantCommentModel(comment: '')));
|
||||
@@ -227,7 +227,7 @@ void main() {
|
||||
sl.registerFactory<DiaryCubit>(() => diaryCubit);
|
||||
sl.registerFactory<ConsultantCommentsCubit>(() => commentsCubit);
|
||||
|
||||
await tester.pumpWidget(wrap(const UserDiaryScreen(diaryId: 1, currentPlanDay: 1)));
|
||||
await tester.pumpWidget(wrap(const UserDiaryScreen(diaryId: 1)));
|
||||
await tester.pump(const Duration(milliseconds: 200));
|
||||
|
||||
expect(find.byType(AppBar), findsWidgets);
|
||||
|
||||
@@ -485,8 +485,9 @@ void main() {
|
||||
|
||||
test('PersonalDietCreationNeededNotification.fromJson parses all fields', () {
|
||||
final json = {
|
||||
'plan_name': 'Custom Plan',
|
||||
'client_name': 'John Doe',
|
||||
'user_name': 'John Doe',
|
||||
'consultant_name': 'Consultant',
|
||||
'my_diets_url': 'https://example.com/diets',
|
||||
'created_at': '2024-01-20T12:00:00Z',
|
||||
};
|
||||
|
||||
@@ -496,8 +497,9 @@ void main() {
|
||||
isRead: true,
|
||||
);
|
||||
|
||||
expect(notification.planName, 'Custom Plan');
|
||||
expect(notification.clientName, 'John Doe');
|
||||
expect(notification.userName, 'John Doe');
|
||||
expect(notification.consultantName, 'Consultant');
|
||||
expect(notification.myDietsUrl, 'https://example.com/diets');
|
||||
expect(notification.isRead, true);
|
||||
expect(notification.type, NotificationType.personalDietCreationNeeded);
|
||||
});
|
||||
@@ -510,8 +512,8 @@ void main() {
|
||||
NotificationType.personalDietCreationNeeded,
|
||||
);
|
||||
|
||||
expect(notification.planName, '');
|
||||
expect(notification.clientName, '');
|
||||
expect(notification.userName, '');
|
||||
expect(notification.consultantName, '');
|
||||
});
|
||||
|
||||
test('ChosenPlanClientLastDayFinishedNotification.fromJson parses all fields', () {
|
||||
@@ -551,7 +553,9 @@ void main() {
|
||||
test('StayOnTrackToAuthorNotification.fromJson parses all fields', () {
|
||||
final json = {
|
||||
'plan_name': 'Track Plan',
|
||||
'client_name': 'Jane Smith',
|
||||
'user_name': 'Jane Smith',
|
||||
'day_num': 1,
|
||||
'diary_day_id': 10,
|
||||
'created_at': '2024-01-24T12:00:00Z',
|
||||
};
|
||||
|
||||
@@ -562,7 +566,7 @@ void main() {
|
||||
);
|
||||
|
||||
expect(notification.planName, 'Track Plan');
|
||||
expect(notification.clientName, 'Jane Smith');
|
||||
expect(notification.userName, 'Jane Smith');
|
||||
expect(notification.isRead, false);
|
||||
expect(notification.type, NotificationType.stayOnTrackToAuthor);
|
||||
});
|
||||
|
||||
@@ -50,6 +50,8 @@ void main() {
|
||||
type: NotificationType.chosenPlanStartedToClientNotification,
|
||||
planName: 'Test Plan',
|
||||
planId: 1,
|
||||
consultantName: '',
|
||||
peerProfileUrl: '',
|
||||
isRead: false,
|
||||
createdAt: DateTime.now(),
|
||||
),
|
||||
@@ -89,6 +91,8 @@ void main() {
|
||||
type: NotificationType.chosenPlanStartedToClientNotification,
|
||||
planName: 'Plan 1',
|
||||
planId: 1,
|
||||
consultantName: '',
|
||||
peerProfileUrl: '',
|
||||
isRead: false,
|
||||
createdAt: DateTime.now(),
|
||||
),
|
||||
@@ -99,6 +103,8 @@ void main() {
|
||||
type: NotificationType.chosenPlanStartedToClientNotification,
|
||||
planName: 'Plan 2',
|
||||
planId: 2,
|
||||
consultantName: '',
|
||||
peerProfileUrl: '',
|
||||
isRead: false,
|
||||
createdAt: DateTime.now(),
|
||||
),
|
||||
@@ -143,6 +149,8 @@ void main() {
|
||||
type: NotificationType.chosenPlanStartedToClientNotification,
|
||||
planName: 'Plan 1',
|
||||
planId: 1,
|
||||
consultantName: '',
|
||||
peerProfileUrl: '',
|
||||
isRead: false,
|
||||
createdAt: DateTime.now(),
|
||||
),
|
||||
@@ -168,6 +176,8 @@ void main() {
|
||||
type: NotificationType.chosenPlanStartedToClientNotification,
|
||||
planName: 'Plan 1',
|
||||
planId: 1,
|
||||
consultantName: '',
|
||||
peerProfileUrl: '',
|
||||
isRead: false,
|
||||
createdAt: DateTime.now(),
|
||||
),
|
||||
@@ -201,6 +211,8 @@ void main() {
|
||||
type: NotificationType.chosenPlanStartedToClientNotification,
|
||||
planName: 'Plan 1',
|
||||
planId: 1,
|
||||
consultantName: '',
|
||||
peerProfileUrl: '',
|
||||
isRead: false,
|
||||
createdAt: DateTime.now(),
|
||||
),
|
||||
@@ -231,6 +243,8 @@ void main() {
|
||||
type: NotificationType.chosenPlanStartedToClientNotification,
|
||||
planName: 'Plan 1',
|
||||
planId: 1,
|
||||
consultantName: '',
|
||||
peerProfileUrl: '',
|
||||
isRead: false,
|
||||
createdAt: DateTime.now(),
|
||||
),
|
||||
@@ -272,6 +286,8 @@ void main() {
|
||||
type: NotificationType.chosenPlanStartedToClientNotification,
|
||||
planName: 'Plan 1',
|
||||
planId: 1,
|
||||
consultantName: '',
|
||||
peerProfileUrl: '',
|
||||
isRead: false,
|
||||
createdAt: DateTime.now(),
|
||||
),
|
||||
@@ -311,6 +327,8 @@ void main() {
|
||||
type: NotificationType.chosenPlanStartedToClientNotification,
|
||||
planName: 'Plan 1',
|
||||
planId: 1,
|
||||
consultantName: '',
|
||||
peerProfileUrl: '',
|
||||
isRead: false,
|
||||
createdAt: DateTime.now(),
|
||||
),
|
||||
@@ -342,6 +360,8 @@ void main() {
|
||||
type: NotificationType.chosenPlanStartedToClientNotification,
|
||||
planName: 'Plan 1',
|
||||
planId: 1,
|
||||
consultantName: '',
|
||||
peerProfileUrl: '',
|
||||
isRead: false,
|
||||
createdAt: DateTime.now(),
|
||||
),
|
||||
@@ -349,6 +369,8 @@ void main() {
|
||||
type: NotificationType.chosenPlanStartedToClientNotification,
|
||||
planName: 'Plan 2',
|
||||
planId: 2,
|
||||
consultantName: '',
|
||||
peerProfileUrl: '',
|
||||
isRead: true,
|
||||
createdAt: DateTime.now(),
|
||||
),
|
||||
@@ -376,6 +398,8 @@ void main() {
|
||||
type: NotificationType.chosenPlanStartedToClientNotification,
|
||||
planName: 'Plan 1',
|
||||
planId: 1,
|
||||
consultantName: '',
|
||||
peerProfileUrl: '',
|
||||
isRead: true,
|
||||
createdAt: DateTime.now(),
|
||||
),
|
||||
@@ -383,6 +407,8 @@ void main() {
|
||||
type: NotificationType.chosenPlanStartedToClientNotification,
|
||||
planName: 'Plan 2',
|
||||
planId: 2,
|
||||
consultantName: '',
|
||||
peerProfileUrl: '',
|
||||
isRead: true,
|
||||
createdAt: DateTime.now(),
|
||||
),
|
||||
@@ -426,6 +452,8 @@ void main() {
|
||||
type: NotificationType.chosenPlanStartedToClientNotification,
|
||||
planName: 'Plan 1',
|
||||
planId: 1,
|
||||
consultantName: '',
|
||||
peerProfileUrl: '',
|
||||
isRead: false,
|
||||
createdAt: DateTime.now(),
|
||||
),
|
||||
@@ -475,6 +503,8 @@ void main() {
|
||||
type: NotificationType.chosenPlanStartedToClientNotification,
|
||||
planName: 'Initial Plan',
|
||||
planId: 1,
|
||||
consultantName: '',
|
||||
peerProfileUrl: '',
|
||||
isRead: false,
|
||||
createdAt: DateTime.now(),
|
||||
),
|
||||
@@ -524,6 +554,8 @@ void main() {
|
||||
type: NotificationType.chosenPlanStartedToClientNotification,
|
||||
planName: 'Initial Plan',
|
||||
planId: 1,
|
||||
consultantName: '',
|
||||
peerProfileUrl: '',
|
||||
isRead: false,
|
||||
createdAt: DateTime.now(),
|
||||
),
|
||||
@@ -568,6 +600,8 @@ void main() {
|
||||
type: NotificationType.chosenPlanStartedToClientNotification,
|
||||
planName: 'Initial Plan',
|
||||
planId: 1,
|
||||
consultantName: '',
|
||||
peerProfileUrl: '',
|
||||
isRead: false,
|
||||
createdAt: DateTime.now(),
|
||||
),
|
||||
@@ -608,6 +642,8 @@ void main() {
|
||||
type: NotificationType.chosenPlanStartedToClientNotification,
|
||||
planName: 'Initial Plan',
|
||||
planId: 1,
|
||||
consultantName: '',
|
||||
peerProfileUrl: '',
|
||||
isRead: false,
|
||||
createdAt: DateTime.now(),
|
||||
),
|
||||
@@ -645,6 +681,8 @@ void main() {
|
||||
type: NotificationType.chosenPlanStartedToClientNotification,
|
||||
planName: 'Initial Plan',
|
||||
planId: 1,
|
||||
consultantName: '',
|
||||
peerProfileUrl: '',
|
||||
isRead: false,
|
||||
createdAt: DateTime.now(),
|
||||
),
|
||||
@@ -688,6 +726,8 @@ void main() {
|
||||
type: NotificationType.chosenPlanStartedToClientNotification,
|
||||
planName: 'Initial Plan',
|
||||
planId: 1,
|
||||
consultantName: '',
|
||||
peerProfileUrl: '',
|
||||
isRead: false,
|
||||
createdAt: DateTime.now(),
|
||||
),
|
||||
@@ -757,6 +797,8 @@ void main() {
|
||||
type: NotificationType.chosenPlanStartedToClientNotification,
|
||||
planName: 'Initial Plan',
|
||||
planId: 1,
|
||||
consultantName: '',
|
||||
peerProfileUrl: '',
|
||||
isRead: false,
|
||||
createdAt: DateTime.now(),
|
||||
),
|
||||
@@ -800,6 +842,8 @@ void main() {
|
||||
type: NotificationType.chosenPlanStartedToClientNotification,
|
||||
planName: 'Initial Plan',
|
||||
planId: 1,
|
||||
consultantName: '',
|
||||
peerProfileUrl: '',
|
||||
isRead: false,
|
||||
createdAt: DateTime.now(),
|
||||
),
|
||||
@@ -843,6 +887,8 @@ void main() {
|
||||
type: NotificationType.chosenPlanStartedToClientNotification,
|
||||
planName: 'Initial Plan',
|
||||
planId: 1,
|
||||
consultantName: '',
|
||||
peerProfileUrl: '',
|
||||
isRead: false,
|
||||
createdAt: DateTime.now(),
|
||||
),
|
||||
@@ -886,6 +932,8 @@ void main() {
|
||||
type: NotificationType.chosenPlanStartedToClientNotification,
|
||||
planName: 'Initial Plan',
|
||||
planId: 1,
|
||||
consultantName: '',
|
||||
peerProfileUrl: '',
|
||||
isRead: false,
|
||||
createdAt: DateTime.now(),
|
||||
),
|
||||
@@ -929,6 +977,8 @@ void main() {
|
||||
type: NotificationType.chosenPlanStartedToClientNotification,
|
||||
planName: 'Initial Plan',
|
||||
planId: 1,
|
||||
consultantName: '',
|
||||
peerProfileUrl: '',
|
||||
isRead: false,
|
||||
createdAt: DateTime.now(),
|
||||
),
|
||||
@@ -972,6 +1022,8 @@ void main() {
|
||||
type: NotificationType.chosenPlanStartedToClientNotification,
|
||||
planName: 'Initial Plan',
|
||||
planId: 1,
|
||||
consultantName: '',
|
||||
peerProfileUrl: '',
|
||||
isRead: false,
|
||||
createdAt: DateTime.now(),
|
||||
),
|
||||
@@ -1015,6 +1067,8 @@ void main() {
|
||||
type: NotificationType.chosenPlanStartedToClientNotification,
|
||||
planName: 'Initial Plan',
|
||||
planId: 1,
|
||||
consultantName: '',
|
||||
peerProfileUrl: '',
|
||||
isRead: false,
|
||||
createdAt: DateTime.now(),
|
||||
),
|
||||
@@ -1058,6 +1112,8 @@ void main() {
|
||||
type: NotificationType.chosenPlanStartedToClientNotification,
|
||||
planName: 'Initial Plan',
|
||||
planId: 1,
|
||||
consultantName: '',
|
||||
peerProfileUrl: '',
|
||||
isRead: false,
|
||||
createdAt: DateTime.now(),
|
||||
),
|
||||
@@ -1100,6 +1156,8 @@ void main() {
|
||||
type: NotificationType.chosenPlanStartedToClientNotification,
|
||||
planName: 'Initial Plan',
|
||||
planId: 1,
|
||||
consultantName: '',
|
||||
peerProfileUrl: '',
|
||||
isRead: false,
|
||||
createdAt: DateTime.now(),
|
||||
),
|
||||
@@ -1137,6 +1195,8 @@ void main() {
|
||||
type: NotificationType.chosenPlanStartedToClientNotification,
|
||||
planName: 'Initial Plan',
|
||||
planId: 1,
|
||||
consultantName: '',
|
||||
peerProfileUrl: '',
|
||||
isRead: false,
|
||||
createdAt: DateTime.now(),
|
||||
),
|
||||
@@ -1174,6 +1234,8 @@ void main() {
|
||||
type: NotificationType.chosenPlanStartedToClientNotification,
|
||||
planName: 'Initial Plan',
|
||||
planId: 1,
|
||||
consultantName: '',
|
||||
peerProfileUrl: '',
|
||||
isRead: false,
|
||||
createdAt: DateTime.now(),
|
||||
),
|
||||
@@ -1217,6 +1279,8 @@ void main() {
|
||||
type: NotificationType.chosenPlanStartedToClientNotification,
|
||||
planName: 'Initial Plan',
|
||||
planId: 1,
|
||||
consultantName: '',
|
||||
peerProfileUrl: '',
|
||||
isRead: false,
|
||||
createdAt: DateTime.now(),
|
||||
),
|
||||
|
||||
@@ -36,8 +36,12 @@ void main() {
|
||||
final notification = PlanSubscriptionStartedToAuthorNotification(
|
||||
type: NotificationType.planSubscriptionStartedToAuthor,
|
||||
planName: 'Test Plan',
|
||||
planId: 1,
|
||||
customerName: 'Test Customer',
|
||||
userId: 0,
|
||||
userPhotoPath: '',
|
||||
chatId: 'chat-123',
|
||||
chatUrl: '',
|
||||
isRead: false,
|
||||
createdAt: DateTime.now(),
|
||||
);
|
||||
|
||||
@@ -31,8 +31,12 @@ void main() {
|
||||
final notification = PlanSubscriptionStartedToAuthorNotification(
|
||||
type: NotificationType.planSubscriptionStartedToAuthor,
|
||||
planName: 'Test Plan',
|
||||
planId: 1,
|
||||
customerName: 'Test Customer',
|
||||
userId: 0,
|
||||
userPhotoPath: '',
|
||||
chatId: 'chat123',
|
||||
chatUrl: '',
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -47,7 +51,11 @@ void main() {
|
||||
final notification = PlanSubscriptionCanceledToAuthorNotification(
|
||||
type: NotificationType.planSubscriptionCanceledToAuthor,
|
||||
planName: 'Test Plan',
|
||||
planId: 1,
|
||||
customerName: 'Test Customer',
|
||||
userId: 0,
|
||||
userPhotoPath: '',
|
||||
chatUrl: '',
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -63,6 +71,8 @@ void main() {
|
||||
type: NotificationType.chosenPlanStartedToClient,
|
||||
planName: 'Test Plan',
|
||||
planId: 1,
|
||||
consultantName: 'Test Consultant',
|
||||
peerProfileUrl: '',
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -77,6 +87,8 @@ void main() {
|
||||
final notification = ChosenPlanTomorrowReminderToClientNotification(
|
||||
type: NotificationType.chosenPlanTomorrowReminderToClient,
|
||||
planName: 'Test Plan',
|
||||
consultantName: '',
|
||||
chatId: 0,
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -103,7 +115,12 @@ void main() {
|
||||
testWidgets('displays ConsultantLeftCommentNotification', (tester) async {
|
||||
final notification = ConsultantLeftCommentNotification(
|
||||
type: NotificationType.consultantLeftComment,
|
||||
chosenPlanId: 1,
|
||||
diaryId: 0,
|
||||
date: testDate,
|
||||
planName: '',
|
||||
userName: '',
|
||||
consultantName: '',
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -131,6 +148,11 @@ void main() {
|
||||
final notification = ChosenPlanFinishedToClientNotification(
|
||||
type: NotificationType.chosenPlanFinishedToClient,
|
||||
planName: 'Test Plan',
|
||||
chosenPlanId: 1,
|
||||
consultantName: '',
|
||||
consultantPhotoPath: '',
|
||||
consultantProfileUrl: '',
|
||||
consultantId: 0,
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -145,6 +167,11 @@ void main() {
|
||||
final notification = PlanSubscriptionCanceledToCustomerNotification(
|
||||
type: NotificationType.planSubscriptionCanceledToCustomer,
|
||||
planName: 'Test Plan',
|
||||
planId: 1,
|
||||
authorName: '',
|
||||
authorId: 0,
|
||||
authorPhotoPath: '',
|
||||
chatUrl: '',
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -162,6 +189,8 @@ void main() {
|
||||
customerName: 'Test Customer',
|
||||
planId: 1,
|
||||
customerId: 1,
|
||||
peerProfileUrl: '',
|
||||
consultationUrl: '',
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -177,6 +206,7 @@ void main() {
|
||||
type: NotificationType.chosenPlanTomorrowReminderToConsultant,
|
||||
planName: 'Test Plan',
|
||||
customerName: 'Test Customer',
|
||||
chatId: 0,
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -191,7 +221,11 @@ void main() {
|
||||
final notification = PlanSubscriptionPaidToAuthorNotification(
|
||||
type: NotificationType.planSubscriptionPaidToAuthor,
|
||||
planName: 'Test Plan',
|
||||
planId: 1,
|
||||
customerName: 'Test Customer',
|
||||
userId: 0,
|
||||
userPhotoPath: '',
|
||||
chatUrl: '',
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -208,6 +242,9 @@ void main() {
|
||||
planName: 'Test Plan',
|
||||
customerName: 'Test Customer',
|
||||
planId: 1,
|
||||
chosenPlanId: 1,
|
||||
clientPhotoPath: '',
|
||||
clientId: 0,
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -221,6 +258,10 @@ void main() {
|
||||
testWidgets('displays ChosenPlanLastDayFinishedForUser', (tester) async {
|
||||
final notification = ChosenPlanLastDayFinishedForUser(
|
||||
type: NotificationType.chosenPlanLastDayFinishedForUser,
|
||||
planName: 'Test Plan',
|
||||
chosenPlanId: 1,
|
||||
complaintUrl: '',
|
||||
chatUrl: '',
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -254,6 +295,7 @@ void main() {
|
||||
message: 'Test message',
|
||||
entityId: 1,
|
||||
entityType: 'test',
|
||||
entityName: 'Test Entity',
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -472,6 +514,7 @@ void main() {
|
||||
final notification = DietCancelledNotification(
|
||||
type: NotificationType.dietCancelled,
|
||||
dietName: 'Test Diet',
|
||||
dietId: 1,
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -486,6 +529,7 @@ void main() {
|
||||
final notification = DietStartedNotification(
|
||||
type: NotificationType.dietStarted,
|
||||
dietName: 'Test Diet',
|
||||
dietId: 1,
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -500,6 +544,7 @@ void main() {
|
||||
final notification = DietExpiredNotification(
|
||||
type: NotificationType.dietExpired,
|
||||
dietName: 'Test Diet',
|
||||
dietId: 1,
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -514,6 +559,7 @@ void main() {
|
||||
final notification = DietWillStartedInNotification(
|
||||
type: NotificationType.dietWillStartedIn,
|
||||
dietName: 'Test Diet',
|
||||
dietId: 1,
|
||||
startDate: '2024-02-01',
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
@@ -529,6 +575,7 @@ void main() {
|
||||
final notification = DietCanNotBeStartedNotification(
|
||||
type: NotificationType.dietCanNotBeStarted,
|
||||
dietName: 'Test Diet',
|
||||
dietId: 1,
|
||||
reason: 'Test reason',
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
@@ -543,8 +590,9 @@ void main() {
|
||||
testWidgets('displays PersonalDietCreationNeededNotification', (tester) async {
|
||||
final notification = PersonalDietCreationNeededNotification(
|
||||
type: NotificationType.personalDietCreationNeeded,
|
||||
planName: 'Test Plan',
|
||||
clientName: 'Test Client',
|
||||
userName: 'Test Client',
|
||||
consultantName: '',
|
||||
myDietsUrl: '',
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -559,6 +607,9 @@ void main() {
|
||||
final notification = ChosenPlanClientLastDayFinishedNotification(
|
||||
type: NotificationType.chosenPlanClientLastDayFinished,
|
||||
planName: 'Test Plan',
|
||||
chosenPlanId: 1,
|
||||
complaintUrl: '',
|
||||
chatUrl: '',
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -573,6 +624,8 @@ void main() {
|
||||
final notification = ChosenPlanClientLastDayStartedNotification(
|
||||
type: NotificationType.chosenPlanClientLastDayStarted,
|
||||
planName: 'Test Plan',
|
||||
chosenPlanId: 1,
|
||||
lastDayDiaryUrl: '',
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -587,9 +640,9 @@ void main() {
|
||||
final notification = StayOnTrackToAuthorNotification(
|
||||
type: NotificationType.stayOnTrackToAuthor,
|
||||
planName: 'Test Plan',
|
||||
clientName: 'Test Client',
|
||||
planId: 1,
|
||||
clientId: 1,
|
||||
userName: 'Test Client',
|
||||
dayNum: 1,
|
||||
diaryDayId: 0,
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -604,6 +657,13 @@ void main() {
|
||||
final notification = ClientStartPlanSubscriptionToSubscriberNotification(
|
||||
type: NotificationType.clientStartPlanSubscriptionToSubscriber,
|
||||
planName: 'Test Plan',
|
||||
planId: 1,
|
||||
authorName: '',
|
||||
authorId: 0,
|
||||
authorPhotoPath: '',
|
||||
chatUrl: '',
|
||||
chatId: '',
|
||||
startDate: '',
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -618,7 +678,11 @@ void main() {
|
||||
final notification = ConsultantConfirmPlanSubscriptionToSubscriberNotification(
|
||||
type: NotificationType.consultantConfirmPlanSubscriptionToSubscriber,
|
||||
planName: 'Test Plan',
|
||||
planId: 1,
|
||||
consultantName: 'Test Consultant',
|
||||
authorId: 0,
|
||||
authorPhotoPath: '',
|
||||
chatUrl: '',
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -633,8 +697,11 @@ void main() {
|
||||
final notification = ClientPaidPlanSubscriptionToAuthorNotification(
|
||||
type: NotificationType.clientPaidPlanSubscriptionToAuthor,
|
||||
planName: 'Test Plan',
|
||||
planId: 1,
|
||||
clientName: 'Test Client',
|
||||
amount: 100.0,
|
||||
userId: 0,
|
||||
userPhotoPath: '',
|
||||
chatUrl: '',
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -648,7 +715,10 @@ void main() {
|
||||
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,
|
||||
@@ -665,7 +735,11 @@ void main() {
|
||||
final notification = ConsultantConfirmPlanSubscriptionToAuthorNotification(
|
||||
type: NotificationType.consultantConfirmPlanSubscriptionToAuthor,
|
||||
planName: 'Test Plan',
|
||||
consultantName: 'Test Consultant',
|
||||
planId: 1,
|
||||
clientName: 'Test Consultant',
|
||||
userId: 0,
|
||||
userPhotoPath: '',
|
||||
chatUrl: '',
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -680,7 +754,11 @@ void main() {
|
||||
final notification = ClientPaidPlanSubscriptionToSubscriberNotification(
|
||||
type: NotificationType.clientPaidPlanSubscriptionToSubscriber,
|
||||
planName: 'Test Plan',
|
||||
amount: 100.0,
|
||||
planId: 1,
|
||||
authorName: '',
|
||||
authorId: 0,
|
||||
authorPhotoPath: '',
|
||||
chatUrl: '',
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -695,7 +773,12 @@ void main() {
|
||||
final notification = ClientStartPlanSubscriptionToAuthorNotification(
|
||||
type: NotificationType.clientStartPlanSubscriptionToAuthor,
|
||||
planName: 'Test Plan',
|
||||
planId: 1,
|
||||
clientName: 'Test Client',
|
||||
userId: 0,
|
||||
userPhotoPath: '',
|
||||
chatId: '',
|
||||
chatUrl: '',
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -710,7 +793,11 @@ void main() {
|
||||
final notification = ClientCancelPlanSubscriptionToAuthorNotification(
|
||||
type: NotificationType.clientCancelPlanSubscriptionToAuthor,
|
||||
planName: 'Test Plan',
|
||||
planId: 1,
|
||||
clientName: 'Test Client',
|
||||
userId: 0,
|
||||
userPhotoPath: '',
|
||||
chatUrl: '',
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -725,6 +812,11 @@ void main() {
|
||||
final notification = ClientCancelPlanSubscriptionToSubscriberNotification(
|
||||
type: NotificationType.clientCancelPlanSubscriptionToSubscriber,
|
||||
planName: 'Test Plan',
|
||||
planId: 1,
|
||||
authorName: '',
|
||||
authorId: 0,
|
||||
authorPhotoPath: '',
|
||||
chatUrl: '',
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -738,9 +830,11 @@ void main() {
|
||||
testWidgets('displays UserDailyReportCompletedNotification', (tester) async {
|
||||
final notification = UserDailyReportCompletedNotification(
|
||||
type: NotificationType.userDailyReportCompleted,
|
||||
chosenPlanId: 1,
|
||||
diaryId: 0,
|
||||
planName: 'Test Plan',
|
||||
clientName: 'Test Client',
|
||||
reportDate: testDate,
|
||||
consultantName: '',
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -755,9 +849,8 @@ void main() {
|
||||
final notification = StayOnTrackToCustomerNotification(
|
||||
type: NotificationType.stayOnTrackToCustomer,
|
||||
planName: 'Test Plan',
|
||||
consultantName: 'Test Consultant',
|
||||
planId: 1,
|
||||
consultantId: 1,
|
||||
dayNum: 1,
|
||||
diaryDayId: 0,
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -786,8 +879,9 @@ void main() {
|
||||
testWidgets('displays SubscriptionNotification', (tester) async {
|
||||
final notification = SubscriptionNotification(
|
||||
type: NotificationType.subscription,
|
||||
subscriptionType: 'monthly',
|
||||
planName: 'Test Plan',
|
||||
userName: '',
|
||||
userPhotoPath: '',
|
||||
userProfileUrl: '',
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -801,8 +895,9 @@ void main() {
|
||||
testWidgets('displays BadgeAwardedNotification', (tester) async {
|
||||
final notification = BadgeAwardedNotification(
|
||||
type: NotificationType.badgeAwarded,
|
||||
badgeName: 'Test Badge',
|
||||
badgeDescription: 'Test Description',
|
||||
badgeTitle: 'Test Badge',
|
||||
badgeType: '',
|
||||
badgeImage: '',
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -816,8 +911,9 @@ void main() {
|
||||
testWidgets('displays BadgeRevokedNotification', (tester) async {
|
||||
final notification = BadgeRevokedNotification(
|
||||
type: NotificationType.badgeRevoked,
|
||||
badgeName: 'Test Badge',
|
||||
reason: 'Test reason',
|
||||
badgeTitle: 'Test Badge',
|
||||
badgeType: '',
|
||||
badgeImage: '',
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -845,8 +941,7 @@ void main() {
|
||||
testWidgets('displays ClientCloseComplaintSuccessNotification', (tester) async {
|
||||
final notification = ClientCloseComplaintSuccessNotification(
|
||||
type: NotificationType.clientCloseComplaintSuccess,
|
||||
complaintType: 'test',
|
||||
entityName: 'Test Entity',
|
||||
planName: 'Test Plan',
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -893,7 +988,6 @@ void main() {
|
||||
final notification = ClientRejectSuccessNotification(
|
||||
type: NotificationType.clientRejectSuccess,
|
||||
planName: 'Test Plan',
|
||||
reason: 'Test reason',
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -909,7 +1003,6 @@ void main() {
|
||||
type: NotificationType.consultantRejectSuccess,
|
||||
planName: 'Test Plan',
|
||||
clientName: 'Test Client',
|
||||
reason: 'Test reason',
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -943,8 +1036,12 @@ void main() {
|
||||
final notification = ProductStatusUpdatedForAuthorNotification(
|
||||
type: NotificationType.productStatusUpdatedForAuthor,
|
||||
productName: 'Test Product',
|
||||
oldStatus: 'pending',
|
||||
newStatus: 'approved',
|
||||
productId: 1,
|
||||
author: '',
|
||||
authorId: 0,
|
||||
status: 'approved',
|
||||
subject: '',
|
||||
messageLine: '',
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
);
|
||||
@@ -973,8 +1070,15 @@ void main() {
|
||||
type: NotificationType.personalDietIsDefinedToCustomer,
|
||||
isRead: false,
|
||||
createdAt: testDate,
|
||||
dietName: 'Test Diet',
|
||||
chosenPlanId: 1,
|
||||
dietId: 1,
|
||||
planName: '',
|
||||
userName: '',
|
||||
consultantName: '',
|
||||
dietName: 'Test Diet',
|
||||
role: '',
|
||||
peerSlug: '',
|
||||
peerImagePath: '',
|
||||
);
|
||||
|
||||
await tester.pumpWidget(createTestWidget(notification));
|
||||
|
||||
@@ -24,6 +24,8 @@ void main() {
|
||||
type: NotificationType.chosenPlanStartedToClientNotification,
|
||||
planName: 'Test Plan',
|
||||
planId: 1,
|
||||
consultantName: 'Test Consultant',
|
||||
peerProfileUrl: '',
|
||||
isRead: false,
|
||||
createdAt: DateTime.now(),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user