forked from eatvio/eatvio_app
test(tests): add comprehensive unit tests for various models and repositories, enhancing test coverage and ensuring correct functionality
This commit is contained in:
@@ -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);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user