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

@@ -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);
});
});
}