test "an activity" do
{:ok, user} = UserBuilder.insert
+ {:ok, follower} = UserBuilder.insert(%{following: [User.ap_followers(user)]})
+
content = "Some content"
+ date = DateTime.utc_now() |> DateTime.to_iso8601
+
activity = %Activity{
id: 1,
data: %{
],
"actor" => User.ap_id(user),
"object" => %{
+ "published" => date,
"type" => "Note",
- "content" => content
- }
+ "content" => content,
+ "inReplyToStatusId" => 213123
+ },
+ "published" => date
}
}
expected_status = %{
"id" => activity.id,
- "user" => UserRepresenter.to_map(user),
+ "user" => UserRepresenter.to_map(user, %{for: follower}),
"is_local" => true,
"attentions" => [],
"statusnet_html" => content,
"text" => content,
- "is_post_verb" => true
+ "is_post_verb" => true,
+ "created_at" => date,
+ "in_reply_to_status_id" => 213123
}
- assert ActivityRepresenter.to_map(activity, %{user: user}) == expected_status
+ assert ActivityRepresenter.to_map(activity, %{user: user, for: follower}) == expected_status
end
end