total rebase
[anni] / test / pleroma / web / activity_pub / transmogrifier / note_handling_test.exs
old mode 100755 (executable)
new mode 100644 (file)
index 7c406fb..2507fa2
@@ -104,6 +104,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.NoteHandlingTest do
       end
     end
 
+    @tag capture_log: true
     test "it does not crash if the object in inReplyTo can't be fetched" do
       data =
         File.read!("test/fixtures/mastodon-post-activity.json")
@@ -220,6 +221,19 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.NoteHandlingTest do
                "<p><span class=\"h-card\"><a href=\"http://localtesting.pleroma.lol/users/lain\" class=\"u-url mention\">@<span>lain</span></a></span></p>"
     end
 
+    test "it works for incoming notices with a nil contentMap (firefish)" do
+      data =
+        File.read!("test/fixtures/mastodon-post-activity-contentmap.json")
+        |> Jason.decode!()
+        |> Map.put("contentMap", nil)
+
+      {:ok, %Activity{data: data, local: false}} = Transmogrifier.handle_incoming(data)
+      object = Object.normalize(data["object"], fetch: false)
+
+      assert object.data["content"] ==
+               "<p><span class=\"h-card\"><a href=\"http://localtesting.pleroma.lol/users/lain\" class=\"u-url mention\">@<span>lain</span></a></span></p>"
+    end
+
     test "it works for incoming notices with to/cc not being an array (kroeg)" do
       data = File.read!("test/fixtures/kroeg-post-activity.json") |> Jason.decode!()
 
@@ -507,7 +521,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.NoteHandlingTest do
       [data: data]
     end
 
-    test "returns not modified object when hasn't containts inReplyTo field", %{data: data} do
+    test "returns not modified object when has no inReplyTo field", %{data: data} do
       assert Transmogrifier.fix_in_reply_to(data) == data
     end
 
@@ -723,6 +737,7 @@ defmodule Pleroma.Web.ActivityPub.Transmogrifier.NoteHandlingTest do
     assert modified.data["context"] == object.data["id"]
   end
 
+  @tag capture_log: true
   test "the reply note uses its parent's ID when context is missing and reply is unreachable" do
     insert(:user, ap_id: "https://mk.absturztau.be/users/8ozbzjs3o8")