2022-02-07 19:23:12 +00:00
|
|
|
pub(crate) mod empty_outbox;
|
2023-02-18 14:50:28 +00:00
|
|
|
pub(crate) mod group_featured;
|
2021-10-28 21:17:59 +00:00
|
|
|
pub(crate) mod group_followers;
|
|
|
|
pub(crate) mod group_moderators;
|
|
|
|
pub(crate) mod group_outbox;
|
2021-11-01 13:05:20 +00:00
|
|
|
|
|
|
|
#[cfg(test)]
|
|
|
|
mod tests {
|
|
|
|
use crate::protocol::{
|
|
|
|
collections::{
|
2022-02-07 19:23:12 +00:00
|
|
|
empty_outbox::EmptyOutbox,
|
2023-02-18 14:50:28 +00:00
|
|
|
group_featured::GroupFeatured,
|
2021-11-01 13:05:20 +00:00
|
|
|
group_followers::GroupFollowers,
|
|
|
|
group_moderators::GroupModerators,
|
|
|
|
group_outbox::GroupOutbox,
|
|
|
|
},
|
2023-02-18 14:50:28 +00:00
|
|
|
tests::{test_json, test_parse_lemmy_item},
|
2021-11-01 13:05:20 +00:00
|
|
|
};
|
2023-11-17 03:51:33 +00:00
|
|
|
use lemmy_utils::error::LemmyResult;
|
2024-01-04 09:47:18 +00:00
|
|
|
use pretty_assertions::assert_eq;
|
2021-11-01 13:05:20 +00:00
|
|
|
|
2022-02-17 22:04:01 +00:00
|
|
|
#[test]
|
2023-11-17 03:51:33 +00:00
|
|
|
fn test_parse_lemmy_collections() -> LemmyResult<()> {
|
|
|
|
test_parse_lemmy_item::<GroupFollowers>("assets/lemmy/collections/group_followers.json")?;
|
2022-01-20 14:13:29 +00:00
|
|
|
let outbox =
|
2023-11-17 03:51:33 +00:00
|
|
|
test_parse_lemmy_item::<GroupOutbox>("assets/lemmy/collections/group_outbox.json")?;
|
2021-11-01 13:05:20 +00:00
|
|
|
assert_eq!(outbox.ordered_items.len() as i32, outbox.total_items);
|
2023-11-17 03:51:33 +00:00
|
|
|
test_parse_lemmy_item::<GroupFeatured>("assets/lemmy/collections/group_featured_posts.json")?;
|
|
|
|
test_parse_lemmy_item::<GroupModerators>("assets/lemmy/collections/group_moderators.json")?;
|
|
|
|
test_parse_lemmy_item::<EmptyOutbox>("assets/lemmy/collections/person_outbox.json")?;
|
|
|
|
Ok(())
|
2021-11-01 13:05:20 +00:00
|
|
|
}
|
2023-02-18 14:50:28 +00:00
|
|
|
|
|
|
|
#[test]
|
2023-11-17 03:51:33 +00:00
|
|
|
fn test_parse_mastodon_collections() -> LemmyResult<()> {
|
|
|
|
test_json::<GroupFeatured>("assets/mastodon/collections/featured.json")?;
|
|
|
|
Ok(())
|
2023-02-18 14:50:28 +00:00
|
|
|
}
|
2021-11-01 13:05:20 +00:00
|
|
|
}
|