chore(version): update app version to 1.3.5+85 and improve test coverage reporting in CI

This commit is contained in:
mso7nueh
2025-12-08 11:19:08 +03:00
parent abe4985f0e
commit c2a506cdbf
148 changed files with 12395 additions and 1889 deletions

View File

@@ -4,62 +4,96 @@ import 'package:flutter_test/flutter_test.dart';
void main() {
group('CommentModel', () {
test('создает CommentModel с правильными значениями', () {
test('создает экземпляр с данными', () {
final comment = Comment(
id: 1,
authorName: 'Author Name',
authorSlug: 'author',
authorProfileIcon: 'https://example.com/icon.jpg',
authorName: 'Test Author',
authorSlug: 'test-author',
authorProfileIcon: 'icon.png',
body: 'Test comment',
childrenComments: [],
createdAt: DateTime(2024, 1, 1),
createdAt: DateTime.now(),
);
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,
),
links: const Links(first: '', last: '', prev: null, next: null),
meta: const Meta(currentPage: 1, from: null, lastPage: 1, links: [], perPage: 10, to: null, total: 0),
);
expect(model.data.length, 1);
expect(model.data.first.id, 1);
expect(model.data.first.body, 'Test comment');
});
test('fromJson создает модель из JSON', () {
final json = {
'data': [
{
'id': 1,
'author_name': 'Test Author',
'author_slug': 'test-author',
'author_profile_icon': 'icon.png',
'body': 'Test comment',
'children_comments': [],
'created_at': '2024-01-01T00:00:00Z',
}
],
'links': {'first': '', 'last': '', 'prev': null, 'next': null},
'meta': {
'current_page': 1,
'from': null,
'last_page': 1,
'links': [],
'per_page': 10,
'to': null,
'total': 0,
},
};
final model = CommentModel.fromJson(json);
expect(model.data.length, 1);
expect(model.data.first.id, 1);
});
});
group('Comment', () {
test('создает Comment с вложенными комментариями', () {
test('создает экземпляр с данными', () {
final comment = Comment(
id: 1,
authorName: 'Test Author',
authorSlug: 'test-author',
authorProfileIcon: 'icon.png',
body: 'Test comment',
childrenComments: [],
createdAt: DateTime.now(),
);
expect(comment.id, 1);
expect(comment.authorName, 'Test Author');
expect(comment.body, 'Test comment');
});
test('поддерживает вложенные комментарии', () {
final childComment = Comment(
id: 2,
authorName: 'Child Author',
authorSlug: 'child-author',
authorProfileIcon: 'https://example.com/icon2.jpg',
authorProfileIcon: 'child.png',
body: 'Child comment',
childrenComments: [],
createdAt: DateTime(2024, 1, 2),
createdAt: DateTime.now(),
);
final parentComment = Comment(
id: 1,
authorName: 'Author Name',
authorSlug: 'author',
authorProfileIcon: 'https://example.com/icon.jpg',
authorName: 'Parent Author',
authorSlug: 'parent-author',
authorProfileIcon: 'parent.png',
body: 'Parent comment',
childrenComments: [childComment],
createdAt: DateTime(2024, 1, 1),
createdAt: DateTime.now(),
);
expect(parentComment.childrenComments.length, 1);