import 'package:eatvio_app/core/models/pagination_model.dart'; import 'package:eatvio_app/features/feed/models/comment_model.dart'; import 'package:flutter_test/flutter_test.dart'; void main() { group('CommentModel', () { test('создает CommentModel с правильными значениями', () { final comment = Comment( id: 1, authorName: 'Author Name', authorSlug: 'author', authorProfileIcon: 'https://example.com/icon.jpg', body: 'Test comment', childrenComments: [], createdAt: DateTime(2024, 1, 1), ); final model = CommentModel( data: [comment], links: const Links( first: 'https://example.com?page=1', last: 'https://example.com?page=1', prev: null, next: null, ), meta: const Meta( currentPage: 1, from: 1, lastPage: 1, links: [], perPage: 10, to: 1, total: 1, ), ); expect(model.data.length, 1); expect(model.data.first.id, 1); expect(model.data.first.body, 'Test comment'); }); }); group('Comment', () { test('создает Comment с вложенными комментариями', () { final childComment = Comment( id: 2, authorName: 'Child Author', authorSlug: 'child-author', authorProfileIcon: 'https://example.com/icon2.jpg', body: 'Child comment', childrenComments: [], createdAt: DateTime(2024, 1, 2), ); final parentComment = Comment( id: 1, authorName: 'Author Name', authorSlug: 'author', authorProfileIcon: 'https://example.com/icon.jpg', body: 'Parent comment', childrenComments: [childComment], createdAt: DateTime(2024, 1, 1), ); expect(parentComment.childrenComments.length, 1); expect(parentComment.childrenComments.first.id, 2); }); }); }