Add test for delete_post()

This commit is contained in:
silverpill 2022-12-14 06:49:11 +00:00
parent d2e2b684e3
commit f2575a0a79

View file

@ -1205,6 +1205,25 @@ mod tests {
assert_eq!(post.updated_at.is_some(), true);
}
#[tokio::test]
#[serial]
async fn test_delete_post() {
let db_client = &mut create_test_database().await;
let user_data = UserCreateData {
username: "test".to_string(),
..Default::default()
};
let user = create_user(db_client, user_data).await.unwrap();
let post_data = PostCreateData {
content: "test post".to_string(),
..Default::default()
};
let post = create_post(db_client, &user.id, post_data).await.unwrap();
let deletion_queue = delete_post(db_client, &post.id).await.unwrap();
assert_eq!(deletion_queue.files.len(), 0);
assert_eq!(deletion_queue.ipfs_objects.len(), 0);
}
#[tokio::test]
#[serial]
async fn test_home_timeline() {