forked from eatvio/eatvio_app
feat(tests): updated tests coverage to 66.5%
This commit is contained in:
@@ -57,6 +57,35 @@ void main() {
|
||||
expect(model.name, 'User Name');
|
||||
expect(model.profilePhotoUrl, isNull);
|
||||
});
|
||||
|
||||
test('toJson serializes ChatUserModel correctly', () {
|
||||
const model = ChatUserModel(
|
||||
id: 1,
|
||||
name: 'User Name',
|
||||
slug: 'user-slug',
|
||||
profilePhotoUrl: 'https://example.com/photo.jpg',
|
||||
);
|
||||
|
||||
final json = model.toJson();
|
||||
|
||||
expect(json['id'], 1);
|
||||
expect(json['name'], 'User Name');
|
||||
expect(json['slug'], 'user-slug');
|
||||
expect(json['profile_photo_url'], 'https://example.com/photo.jpg');
|
||||
});
|
||||
|
||||
test('toJson handles null profilePhotoUrl', () {
|
||||
const model = ChatUserModel(
|
||||
id: 1,
|
||||
name: 'User Name',
|
||||
slug: 'user-slug',
|
||||
profilePhotoUrl: null,
|
||||
);
|
||||
|
||||
final json = model.toJson();
|
||||
|
||||
expect(json['profile_photo_url'], isNull);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user