feat(personalized_feed): fixed photos rendering and fixed profile posts rendering

This commit is contained in:
misha
2026-07-23 15:17:01 +03:00
parent c8c8ade083
commit a6fe6afb80
13 changed files with 491 additions and 406 deletions

View File

@@ -3,9 +3,11 @@ import 'package:eatvio_app/features/profile/models/circumference_model.dart';
import 'package:eatvio_app/features/profile/models/profile_model.dart';
import 'package:eatvio_app/features/profile/models/weight_model.dart';
import 'package:eatvio_app/features/profile/services/profile_service.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:mockito/annotations.dart';
import 'package:mockito/mockito.dart';
import 'package:flutter_test/flutter_test.dart';
import '../../../fixtures/feed_fixtures.dart';
import 'profile_service_test.mocks.dart';
@GenerateNiceMocks([MockSpec<ProfileService>()])
@@ -72,9 +74,17 @@ void main() {
expect(await mockProfileService.getProfileDetailsBySlug(slug: 'slug'), isA<ProfileDetailsModel>());
});
test('getBlogPostByAuthorSlug', () async {
when(mockProfileService.getBlogPostByAuthorSlug(slug: '')).thenAnswer((_) async => []);
expect(await mockProfileService.getBlogPostByAuthorSlug(slug: 'slug'), isA<List<FeedBlogPostModel>>());
test('getBlogPostByAuthorSlug returns posts with gallery and video fields', () async {
final posts = FeedFixtures.blogPostsByAuthor();
when(mockProfileService.getBlogPostByAuthorSlug(slug: 'slug')).thenAnswer((_) async => posts);
final result = await mockProfileService.getBlogPostByAuthorSlug(slug: 'slug');
expect(result, isA<List<FeedBlogPostModel>>());
expect(result, hasLength(2));
expect(result.first.images, isNotEmpty);
expect(result.first.videoEmbedUrl, isNotNull);
expect(result.first.videoUrlThumb, isNotNull);
});
test('getWeight', () async {