fix: localize diet notification and type plan options

This commit is contained in:
2026-11-10 13:52:06 +03:00
parent da0ac9d396
commit 28ae75474a
13 changed files with 281 additions and 71 deletions

View File

@@ -1233,10 +1233,68 @@ void main() {
await tester.pumpWidget(createTestWidget(notification));
await tester.pumpAndSettle();
expect(find.textContaining('Вы предложили персональную диету пользователю Client'), findsOneWidget);
expect(find.textContaining('Test Diet'), findsOneWidget);
expect(
find.text('Вы предложили персональную диету пользователю Client, выбранная диета: «Test Diet»'),
findsOneWidget,
);
});
testWidgets(
'displays PersonalDietIsDefinedToAuthorNotification with fallback user name',
(tester) async {
final notification = PersonalDietIsDefinedToAuthorNotification(
type: NotificationType.personalDietIsDefinedToAuthor,
isRead: false,
createdAt: testDate,
chosenPlanId: 1,
dietId: 1,
planName: 'Plan',
userName: '',
consultantName: 'Consultant',
dietName: 'Test Diet',
role: 'consultant',
peerSlug: 'client-slug',
peerImagePath: '',
);
await tester.pumpWidget(createTestWidget(notification));
await tester.pumpAndSettle();
expect(
find.text('Вы предложили персональную диету пользователю Пользователь, выбранная диета: «Test Diet»'),
findsOneWidget,
);
},
);
testWidgets(
'displays PersonalDietIsDefinedToAuthorNotification without diet name',
(tester) async {
final notification = PersonalDietIsDefinedToAuthorNotification(
type: NotificationType.personalDietIsDefinedToAuthor,
isRead: false,
createdAt: testDate,
chosenPlanId: 1,
dietId: 1,
planName: 'Plan',
userName: 'Client',
consultantName: 'Consultant',
dietName: '',
role: 'consultant',
peerSlug: 'client-slug',
peerImagePath: '',
);
await tester.pumpWidget(createTestWidget(notification));
await tester.pumpAndSettle();
expect(
find.text('Вы предложили персональную диету пользователю Client'),
findsOneWidget,
);
},
);
testWidgets('displays UnknownNotification', (tester) async {
final notification = UnknownNotification(
type: NotificationType.unknown,