diff --git a/src/atom/feeds.rs b/src/atom/feeds.rs index 1626b7a..6247f70 100644 --- a/src/atom/feeds.rs +++ b/src/atom/feeds.rs @@ -83,3 +83,40 @@ pub fn make_feed( entries=entries.join("\n"), ) } + +#[cfg(test)] +mod tests { + use chrono::{TimeZone, Utc}; + use uuid::uuid; + use super::*; + + #[test] + fn test_make_entry() { + let instance_url = "https://example.org"; + let author = DbActorProfile { + username: "username".to_string(), + ..Default::default() + }; + let post_id = uuid!("67e55044-10b1-426f-9247-bb680e5fe0c8"); + let created_at = Utc.with_ymd_and_hms(2020, 3, 3, 3, 3, 3).unwrap(); + let post = Post { + id: post_id, + author: author, + content: "
title
text text text
".to_string(), + created_at: created_at, + ..Default::default() + }; + let entry = make_entry(instance_url, &post); + let expected_entry = concat!( + "