]> Untitled Git - lemmy.git/blobdiff - crates/apub/src/protocol/activities/mod.rs
Reorganize federation tests (#2092)
[lemmy.git] / crates / apub / src / protocol / activities / mod.rs
index 9279cab12cbf2b0369ff831616b30a4dab120e71..0f9509319febdec043c2e0cba5e6fea5892b0017 100644 (file)
@@ -13,3 +13,46 @@ pub enum CreateOrUpdateType {
   Create,
   Update,
 }
+
+#[cfg(test)]
+mod tests {
+  use crate::protocol::{
+    activities::{
+      create_or_update::{comment::CreateOrUpdateComment, post::CreateOrUpdatePost},
+      deletion::delete::Delete,
+      following::{follow::FollowCommunity, undo_follow::UndoFollowCommunity},
+    },
+    tests::test_json,
+  };
+
+  #[test]
+  fn test_parse_smithereen_activities() {
+    test_json::<CreateOrUpdateComment>("assets/smithereen/activities/create_note.json").unwrap();
+  }
+
+  #[test]
+  fn test_parse_pleroma_activities() {
+    test_json::<CreateOrUpdateComment>("assets/pleroma/activities/create_note.json").unwrap();
+    test_json::<Delete>("assets/pleroma/activities/delete.json").unwrap();
+    test_json::<FollowCommunity>("assets/pleroma/activities/follow.json").unwrap();
+  }
+
+  #[test]
+  fn test_parse_mastodon_activities() {
+    test_json::<CreateOrUpdateComment>("assets/mastodon/activities/create_note.json").unwrap();
+    test_json::<Delete>("assets/mastodon/activities/delete.json").unwrap();
+    test_json::<FollowCommunity>("assets/mastodon/activities/follow.json").unwrap();
+    test_json::<UndoFollowCommunity>("assets/mastodon/activities/undo_follow.json").unwrap();
+  }
+
+  #[test]
+  fn test_parse_lotide_activities() {
+    test_json::<CreateOrUpdatePost>("assets/lotide/activities/create_page.json").unwrap();
+    test_json::<CreateOrUpdateComment>("assets/lotide/activities/create_note_reply.json").unwrap();
+  }
+
+  #[test]
+  fn test_parse_friendica_activities() {
+    test_json::<CreateOrUpdateComment>("assets/friendica/activities/create_note.json").unwrap();
+  }
+}