From 6e2bff10f77a21f7f955010361c2dbad18cbbd08 Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Mon, 21 Mar 2022 10:32:29 +0900 Subject: [PATCH] Add test for Post::build_delete07() --- plume-models/src/posts.rs | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/plume-models/src/posts.rs b/plume-models/src/posts.rs index a4bded7a..1e29f243 100644 --- a/plume-models/src/posts.rs +++ b/plume-models/src/posts.rs @@ -1628,4 +1628,30 @@ mod tests { Ok(()) }); } + + #[test] + fn build_delete07() { + let conn = db(); + conn.test_transaction::<_, Error, _>(|| { + let (post, _mention, _posts, _users, _blogs) = prepare_activity(&conn); + let act = post.build_delete07(&conn)?; + + let expected = json!({ + "actor": "https://plu.me/@/admin/", + "id": "https://plu.me/~/BlogName/testing#delete", + "object": { + "id": "https://plu.me/~/BlogName/testing", + "type": "Tombstone" + }, + "to": [ + "https://www.w3.org/ns/activitystreams#Public" + ], + "type": "Delete" + }); + + assert_json_eq!(to_value(act)?, expected); + + Ok(()) + }); + } }