Merge remote-tracking branch 'origin/patch/readd-mastofe' into develop
[akkoma] / test / pleroma / web / activity_pub / object_validators / article_note_page_validator_test.exs
index 720c17d8da7e731da5c134dfce4699c274ecf48e..2bd1e46c131376f719a5c3ede92940c4e99779cf 100644 (file)
@@ -31,5 +31,26 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNotePageValidatorTest
     test "a basic note validates", %{note: note} do
       %{valid?: true} = ArticleNotePageValidator.cast_and_validate(note)
     end
+
+    test "a note with a remote replies collection should validate", _ do
+      insert(:user, %{ap_id: "https://bookwyrm.com/user/TestUser"})
+      collection = File.read!("test/fixtures/bookwyrm-replies-collection.json")
+
+      Tesla.Mock.mock(fn %{
+                           method: :get,
+                           url: "https://bookwyrm.com/user/TestUser/review/17/replies?page=1"
+                         } ->
+        %Tesla.Env{
+          status: 200,
+          body: collection,
+          headers: HttpRequestMock.activitypub_object_headers()
+        }
+      end)
+
+      note = Jason.decode!(File.read!("test/fixtures/bookwyrm-article.json"))
+
+      %{valid?: true, changes: %{replies: ["https://bookwyrm.com/user/TestUser/status/18"]}} =
+        ArticleNotePageValidator.cast_and_validate(note)
+    end
   end
 end