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:
@@ -28,6 +28,32 @@ void main() {
|
||||
expect(model.messagesList.first.id, 1);
|
||||
expect(model.meta.lastPage, 1);
|
||||
});
|
||||
|
||||
test('fromJson создает ChatMessagesModel из JSON', () {
|
||||
final json = {
|
||||
'data': [
|
||||
{
|
||||
'id': 1,
|
||||
'data': 'Test message',
|
||||
'media_data': null,
|
||||
'author_id': 123,
|
||||
'updated_at': '2024-01-01T00:00:00Z',
|
||||
'read_by_to_user': false,
|
||||
'is_author_message_auth_user': true,
|
||||
'room_id': 'room-1',
|
||||
}
|
||||
],
|
||||
'meta': {
|
||||
'last_page': 1,
|
||||
},
|
||||
};
|
||||
|
||||
final model = ChatMessagesModel.fromJson(json);
|
||||
|
||||
expect(model.messagesList.length, 1);
|
||||
expect(model.messagesList.first.id, 1);
|
||||
expect(model.meta.lastPage, 1);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user