import 'package:eatvio_app/features/feed/models/recipes_pagination_model.dart'; import 'package:eatvio_app/features/feed/models/recipes_model.dart'; import 'package:eatvio_app/features/feed/models/diets_pagination_model.dart'; import 'package:flutter_test/flutter_test.dart'; void main() { group('RecipesPagination', () { test('creates RecipesPagination with empty list', () { const pagination = RecipesPagination(recipesList: []); expect(pagination.recipesList, isEmpty); }); test('creates RecipesPagination with recipes list', () { final recipes = [ const Recipe( id: 1, image: 'image1.jpg', state: 'published', cookingTime: 30, activeCookingTime: 15, ingredients: null, description: 'Test recipe 1', steps: null, videoUrl: null, createdAt: null, updatedAt: null, title: 'Recipe 1', type: 'main', slug: 'recipe-1', commentsCount: 5, wasLikedByMe: false, isFavorite: false, calories: 250.0, servings: 4, likesCount: 10, viewsCount: 100, tags: [], author: Author( authorSlug: 'chef', authorName: 'Chef', authorProfileIcon: 'photo.jpg', authorIsMe: false, isEntitySubscribedByMe: false, authorPlaceInRating: null, ), ), ]; final pagination = RecipesPagination(recipesList: recipes); expect(pagination.recipesList.length, 1); expect(pagination.recipesList[0].id, 1); expect(pagination.recipesList[0].title, 'Recipe 1'); }); test('creates RecipesPagination from JSON', () { final json = { 'data': [ { 'id': 1, 'image': 'image1.jpg', 'state': 'published', 'cooking_time': 30, 'active_time': 15, 'ingredients': null, 'description_md': 'Test recipe', 'steps': null, 'video_url': null, 'created_at': null, 'updated_at': null, 'title': 'Recipe 1', 'type': 'main', 'slug': 'recipe-1', 'total_comments': 5, 'was_liked_by_me': false, 'is_favorite': false, 'energy_per_serving': 250.0, 'servings': 4, 'total_likes': 10, 'total_views': 100, 'tags': [], 'author': { 'author_slug': 'chef', 'author_name': 'Chef', 'author_profile_icon': 'photo.jpg', 'author_is_me': false, 'is_entity_subscribed_by_me': false, }, }, ], }; final pagination = RecipesPagination.fromJson(json); expect(pagination.recipesList.length, 1); expect(pagination.recipesList[0].id, 1); }); }); }