Add test for Comment::to_activity07()
This commit is contained in:
parent
86b4f622ea
commit
1c1dbd481a
@ -596,6 +596,38 @@ mod tests {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[test]
|
||||||
|
fn to_activity07() {
|
||||||
|
let conn = db();
|
||||||
|
conn.test_transaction::<_, Error, _>(|| {
|
||||||
|
let (comment, _posts, _users, _blogs) = prepare_activity(&conn);
|
||||||
|
let act = comment.to_activity07(&conn)?;
|
||||||
|
|
||||||
|
let expected = json!({
|
||||||
|
"attributedTo": "https://plu.me/@/admin/",
|
||||||
|
"content": r###"<p dir="auto">My comment, mentioning to <a href="https://plu.me/@/user/" title="user">@user</a></p>
|
||||||
|
"###,
|
||||||
|
"id": format!("https://plu.me/~/BlogName/testing/comment/{}", comment.id),
|
||||||
|
"inReplyTo": "https://plu.me/~/BlogName/testing",
|
||||||
|
"published": format_datetime(&comment.creation_date),
|
||||||
|
"summary": "My CW",
|
||||||
|
"tag": [
|
||||||
|
{
|
||||||
|
"href": "https://plu.me/@/user/",
|
||||||
|
"name": "@user",
|
||||||
|
"type": "Mention"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"to": ["https://www.w3.org/ns/activitystreams#Public"],
|
||||||
|
"type": "Note"
|
||||||
|
});
|
||||||
|
|
||||||
|
assert_json_eq!(to_value(act)?, expected);
|
||||||
|
|
||||||
|
Ok(())
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn build_delete() {
|
fn build_delete() {
|
||||||
let conn = db();
|
let conn = db();
|
||||||
|
Loading…
Reference in New Issue
Block a user