feat(tests): fixed notifications tests

This commit is contained in:
misha
2026-02-18 20:19:23 +03:00
parent c540cbe6df
commit 6f666a8859
6 changed files with 223 additions and 45 deletions

View File

@@ -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);
});