Add test for Tag::from_activity07()

This commit is contained in:
Kitaiti Makoto 2022-05-02 21:00:44 +09:00
parent 28440271bb
commit c4bb1f771b

View File

@ -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::<IriString>()?);
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] #[test]
fn build_activity() { fn build_activity() {
let conn = &db(); let conn = &db();