tests: twitterapi: add additional fields
[akkoma] / test / web / twitter_api / views / activity_view_test.exs
index a101e4ae8b96c8f29c68ad654eb06274ddcf45e8..5cef06f882e7017c3c473685a978d92fa96bcacd 100644 (file)
@@ -36,6 +36,10 @@ defmodule Pleroma.Web.TwitterAPI.ActivityViewTest do
       "favorited" => false,
       "id" => activity.id,
       "in_reply_to_status_id" => nil,
+      "in_reply_to_screen_name" => nil,
+      "in_reply_to_user_id" => nil,
+      "in_reply_to_profileurl" => nil,
+      "in_reply_to_ostatus_uri" => nil,
       "is_local" => true,
       "is_post_verb" => true,
       "possibly_sensitive" => false,
@@ -126,6 +130,33 @@ defmodule Pleroma.Web.TwitterAPI.ActivityViewTest do
     assert result == expected
   end
 
+  test "a like activity for deleted post" do
+    user = insert(:user)
+    other_user = insert(:user, %{nickname: "shp"})
+
+    {:ok, activity} = CommonAPI.post(user, %{"status" => "Hey @shp!"})
+    {:ok, like, _object} = CommonAPI.favorite(activity.id, other_user)
+    CommonAPI.delete(activity.id, user)
+
+    result = ActivityView.render("activity.json", activity: like)
+
+    expected = %{
+      "activity_type" => "like",
+      "created_at" => like.data["published"] |> Utils.date_to_asctime(),
+      "external_url" => like.data["id"],
+      "id" => like.id,
+      "in_reply_to_status_id" => nil,
+      "is_local" => true,
+      "is_post_verb" => false,
+      "statusnet_html" => "shp favorited a status.",
+      "text" => "shp favorited a status.",
+      "uri" => "tag:#{like.data["id"]}:objectType=Favourite",
+      "user" => UserView.render("show.json", user: other_user)
+    }
+
+    assert result == expected
+  end
+
   test "an announce activity" do
     user = insert(:user)
     other_user = insert(:user, %{nickname: "shp"})