forked from eatvio/eatvio_app
fix: show personal diet name and consultant notifications
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:eatvio_app/features/notifications/models/notification_model.dart';
|
||||
import 'package:eatvio_app/features/notifications/service/notifications_service.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:mockito/annotations.dart';
|
||||
@@ -1454,6 +1455,42 @@ void main() {
|
||||
expect(result, isNotNull);
|
||||
expect(result!['notifications'], isA<List>());
|
||||
expect(result['notifications'].length, 1);
|
||||
expect(result['notifications'].first, isA<PersonalDietIsDefinedToCustomerNotification>());
|
||||
});
|
||||
|
||||
test('getNotifications - обрабатывает PersonalDietIsDefinedToAuthor', () async {
|
||||
const page = 1;
|
||||
final response = Response(
|
||||
data: {
|
||||
'data': [
|
||||
{
|
||||
'type': 'personal-diet-is-defined-to-author',
|
||||
'data': {
|
||||
'diet_name': 'Test Diet',
|
||||
'diet_id': 1,
|
||||
'user_name': 'Client',
|
||||
},
|
||||
'read_at': null,
|
||||
'created_at': '2024-01-01T12:00:00Z',
|
||||
},
|
||||
],
|
||||
'current_page': 1,
|
||||
'last_page': 1,
|
||||
'per_page': 10,
|
||||
'total': 1,
|
||||
},
|
||||
statusCode: 200,
|
||||
requestOptions: RequestOptions(path: '/api/profile/notifications'),
|
||||
);
|
||||
|
||||
when(mockDio.get(any)).thenAnswer((_) async => response);
|
||||
|
||||
final result = await notificationsService.getNotifications(page: page);
|
||||
|
||||
expect(result, isNotNull);
|
||||
expect(result!['notifications'], isA<List>());
|
||||
expect(result['notifications'].length, 1);
|
||||
expect(result['notifications'].first, isA<PersonalDietIsDefinedToAuthorNotification>());
|
||||
});
|
||||
|
||||
test('getNotifications - обрабатывает UserDailyReportCompleted', () async {
|
||||
|
||||
Reference in New Issue
Block a user