From c4bb1f771b68b27f418056c493d2b42df7a0b82b Mon Sep 17 00:00:00 2001 From: Kitaiti Makoto Date: Mon, 2 May 2022 21:00:44 +0900 Subject: [PATCH] Add test for Tag::from_activity07() --- plume-models/src/tags.rs | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/plume-models/src/tags.rs b/plume-models/src/tags.rs index 7631358b..c41700c9 100644 --- a/plume-models/src/tags.rs +++ b/plume-models/src/tags.rs @@ -165,6 +165,24 @@ mod tests { }); } + #[test] + fn from_activity07() { + let conn = &db(); + conn.test_transaction::<_, Error, _>(|| { + let (posts, _users, _blogs) = fill_database(conn); + let post_id = posts[0].id; + let mut ht = Hashtag07::new(); + ht.set_href(ap_url(&format!("https://plu.me/tag/a_tag")).parse::()?); + ht.set_name("a_tag".to_string()); + let tag = Tag::from_activity07(conn, &ht, post_id, true)?; + + assert_eq!(&tag.tag, "a_tag"); + assert!(tag.is_hashtag); + + Ok(()) + }); + } + #[test] fn build_activity() { let conn = &db();