feat(dependencies): add rxdart package and improve string extension methods for better handling of empty strings and gender parsing

This commit is contained in:
mso7nueh
2025-12-04 15:45:54 +03:00
parent 0cd8e662d9
commit 953230b387
100 changed files with 7202 additions and 14 deletions

View File

@@ -0,0 +1,69 @@
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);
});
});
}