test "it favorites a status, returns the updated activity" do
user = insert(:user)
+ other_user = insert(:user)
note_activity = insert(:note_activity)
{:ok, status} = TwitterAPI.fav(user, note_activity.id)
updated_activity = Activity.get_by_ap_id(note_activity.data["id"])
+ assert ActivityView.render("activity.json", %{activity: updated_activity})["fave_num"] == 1
+
+ object = Object.normalize(note_activity.data["object"])
+
+ assert object.data["like_count"] == 1
assert status == updated_activity
+
+ {:ok, _status} = TwitterAPI.fav(other_user, note_activity.id)
+
+ object = Object.normalize(note_activity.data["object"])
+
+ assert object.data["like_count"] == 2
+
+ updated_activity = Activity.get_by_ap_id(note_activity.data["id"])
+ assert ActivityView.render("activity.json", %{activity: updated_activity})["fave_num"] == 2
end
test "it unfavorites a status, returns the updated activity" do
assert represented["id"] == UserView.render("show.json", %{user: remote, for: user})["id"]
# Also fetches the feed.
- # assert Activity.get_create_activity_by_object_ap_id("tag:mastodon.social,2017-04-05:objectId=1641750:objectType=Status")
+ # assert Activity.get_create_by_object_ap_id("tag:mastodon.social,2017-04-05:objectId=1641750:objectType=Status")
end
end
end