import 'package:eatvio_app/features/diary/models/consultant_comment_model.dart'; import 'package:flutter_test/flutter_test.dart'; void main() { group('ConsultantCommentModel', () { test('создает ConsultantCommentModel с дефолтными значениями', () { final model = ConsultantCommentModel(); expect(model.comment, isNull); expect(model.mealsComments, isEmpty); expect(model.portions, isEmpty); }); test('создает ConsultantCommentModel с комментариями', () { final model = ConsultantCommentModel( comment: 'General comment', mealsComments: { 'breakfast': MealCommentModel( comment: 'Breakfast comment', typeNumber: 1, ), }, portions: [ PortionCommentModel( comment: 'Portion comment', id: 1, ), ], ); expect(model.comment, 'General comment'); expect(model.mealsComments.length, 1); expect(model.portions.length, 1); }); test('fromJson создает ConsultantCommentModel из JSON', () { final json = { 'comment': 'General comment', 'meals': { 'breakfast': { 'comment': 'Breakfast comment', 'type_no': 1, }, }, 'portions': [ { 'comment': 'Portion comment', 'id': 1, }, ], }; final model = ConsultantCommentModel.fromJson(json); expect(model.comment, 'General comment'); expect(model.mealsComments.length, 1); expect(model.portions.length, 1); }); }); group('MealCommentModel', () { test('создает MealCommentModel с правильными значениями', () { final model = MealCommentModel( comment: 'Test comment', typeNumber: 1, ); expect(model.comment, 'Test comment'); expect(model.typeNumber, 1); }); test('fromJson создает MealCommentModel из JSON', () { final json = { 'comment': 'Test comment', 'type_no': 1, }; final model = MealCommentModel.fromJson(json); expect(model.comment, 'Test comment'); expect(model.typeNumber, 1); }); }); group('PortionCommentModel', () { test('создает PortionCommentModel с правильными значениями', () { final model = PortionCommentModel( comment: 'Portion comment', id: 1, ); expect(model.comment, 'Portion comment'); expect(model.id, 1); }); test('fromJson создает PortionCommentModel из JSON', () { final json = { 'comment': 'Portion comment', 'id': 1, }; final model = PortionCommentModel.fromJson(json); expect(model.comment, 'Portion comment'); expect(model.id, 1); }); }); }