Quote posting (#113)
[akkoma] / test / pleroma / web / activity_pub / builder_test.exs
index 103521c96032bcc28af6a9e0444551e9586808ce..640caa2b64c71899fd9cb099abf43c7d6548fd5f 100644 (file)
@@ -13,6 +13,7 @@ defmodule Pleroma.Web.ActivityPub.BuilderTest do
     test "returns note data" do
       user = insert(:user)
       note = insert(:note)
+      quote = insert(:note)
       user2 = insert(:user)
       user3 = insert(:user)
 
@@ -25,22 +26,26 @@ defmodule Pleroma.Web.ActivityPub.BuilderTest do
         tags: [name: "jimm"],
         summary: "test summary",
         cc: [user3.ap_id],
-        extra: %{"custom_tag" => "test"}
+        extra: %{"custom_tag" => "test"},
+        quote: quote
       }
 
-      assert Builder.note(draft) == %{
-               "actor" => user.ap_id,
-               "attachment" => [],
-               "cc" => [user3.ap_id],
-               "content" => "<h1>This is :moominmamma: note</h1>",
-               "context" => "2hu",
-               "sensitive" => false,
-               "summary" => "test summary",
-               "tag" => ["jimm"],
-               "to" => [user2.ap_id],
-               "type" => "Note",
-               "custom_tag" => "test"
-             }
+      expected = %{
+        "actor" => user.ap_id,
+        "attachment" => [],
+        "cc" => [user3.ap_id],
+        "content" => "<h1>This is :moominmamma: note</h1>",
+        "context" => "2hu",
+        "sensitive" => false,
+        "summary" => "test summary",
+        "tag" => ["jimm"],
+        "to" => [user2.ap_id],
+        "type" => "Note",
+        "custom_tag" => "test",
+        "quoteUri" => quote.data["id"]
+      }
+
+      assert {:ok, ^expected, []} = Builder.note(draft)
     end
   end
 end