test(tests): add comprehensive unit tests for various models and repositories, enhancing test coverage and ensuring correct functionality

This commit is contained in:
mso7nueh
2025-12-09 16:19:48 +03:00
parent edd064d20d
commit 70e4a42e98
25 changed files with 2565 additions and 58 deletions

View File

@@ -27,6 +27,36 @@ void main() {
expect(model.profilePhotoUrl, isNull);
});
test('fromJson создает ChatUserModel из JSON', () {
final json = {
'id': 1,
'name': 'User Name',
'slug': 'user-slug',
'profile_photo_url': 'https://example.com/photo.jpg',
};
final model = ChatUserModel.fromJson(json);
expect(model.id, 1);
expect(model.name, 'User Name');
expect(model.slug, 'user-slug');
expect(model.profilePhotoUrl, 'https://example.com/photo.jpg');
});
test('fromJson создает ChatUserModel из JSON без фото', () {
final json = {
'id': 1,
'name': 'User Name',
'slug': 'user-slug',
};
final model = ChatUserModel.fromJson(json);
expect(model.id, 1);
expect(model.name, 'User Name');
expect(model.profilePhotoUrl, isNull);
});
});
}