import 'package:eatvio_app/features/create_recipe/models/recipe_model.dart'; import 'package:flutter_test/flutter_test.dart'; void main() { group('RecipeModel', () { test('создает RecipeModel с правильными значениями', () { const model = RecipeModel( ingredients: [], steps: [], tags: ['tag1', 'tag2'], type: 'breakfast', state: 'active', title: 'Test Recipe', description: 'Test Description', videoUrl: 'https://example.com/video.mp4', image: 'https://example.com/image.jpg', totalCookingTime: 30, activeCookTime: 20, servings: 4, energyPerServing: 250, ); expect(model.title, 'Test Recipe'); expect(model.description, 'Test Description'); expect(model.totalCookingTime, 30); expect(model.servings, 4); }); test('создает RecipeModel с null значениями', () { const model = RecipeModel(); expect(model.ingredients, isNull); expect(model.steps, isNull); expect(model.tags, isNull); expect(model.type, isNull); expect(model.state, isNull); expect(model.title, isNull); }); test('fromJson создает RecipeModel из JSON', () { final json = { 'ingredients': [], 'steps': [], 'tags': ['tag1', 'tag2'], 'type': 'breakfast', 'state': 'active', 'title': 'Test Recipe', 'description': 'Test Description', 'video_url': 'https://example.com/video.mp4', 'image': 'https://example.com/image.jpg', 'total_cooking_time': 30, 'active_cook_time': 20, 'servings': 4, 'energy_per_serving': 250, }; final model = RecipeModel.fromJson(json); expect(model.title, 'Test Recipe'); expect(model.description, 'Test Description'); expect(model.videoUrl, 'https://example.com/video.mp4'); expect(model.tags, ['tag1', 'tag2']); }); test('fromJson создает RecipeModel из JSON с null значениями', () { final json = {}; final model = RecipeModel.fromJson(json); expect(model.ingredients, isNull); expect(model.steps, isNull); expect(model.tags, isNull); expect(model.title, isNull); }); }); }