docs/installation: Update required Elixir version to 1.12
[akkoma] / test / pleroma / web / activity_pub / object_validators / article_note_page_validator_test.exs
index 80290a6e315bd312d17fd1b9411a74bb840c8d1e..09cd1a964f55b694ff6dd4c784213284bab68a1d 100644 (file)
@@ -130,74 +130,21 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNotePageValidatorTest
         |> Jason.decode!()
 
       expected_content =
-        "<span class=\"h-card\"><a class=\"u-url mention\" data-user=\"#{local_user.id}\" href=\"#{local_user.ap_id}\" rel=\"ugc\">@<span>akkoma_user</span></a></span> linkifylink <a class=\"hashtag\" data-tag=\"dancedance\" href=\"http://localhost:4001/tag/dancedance\" rel=\"tag ugc\">#dancedance</a> $[jelly mfm goes here] <br><br>## aaa"
+        "<span class=\"h-card\"><a class=\"u-url mention\" data-user=\"#{local_user.id}\" href=\"#{local_user.ap_id}\" rel=\"ugc\">@<span>akkoma_user</span></a></span> linkifylink <a class=\"hashtag\" data-tag=\"dancedance\" href=\"http://localhost:4001/tag/dancedance\">#dancedance</a> $[jelly mfm goes here] <br><br>## aaa"
+
+      changes = ArticleNotePageValidator.cast_and_validate(note)
 
       %{
         valid?: true,
         changes: %{
-          content: ^expected_content,
           source: %{
             "content" => "@akkoma_user linkifylink #dancedance $[jelly mfm goes here] \n\n## aaa",
             "mediaType" => "text/x.misskeymarkdown"
           }
         }
-      } = ArticleNotePageValidator.cast_and_validate(note)
-    end
-
-    test "a misskey quote should work", _ do
-      Tesla.Mock.mock(fn %{
-                           method: :get,
-                           url: "https://example.com/objects/43479e20-c0f8-4f49-bf7f-13fab8234924"
-                         } ->
-        %Tesla.Env{
-          status: 200,
-          body: File.read!("test/fixtures/quoted_status.json"),
-          headers: HttpRequestMock.activitypub_object_headers()
-        }
-      end)
-
-      insert(:user, %{ap_id: "https://misskey.io/users/93492q0ip0"})
-      insert(:user, %{ap_id: "https://example.com/users/user"})
-
-      note =
-        "test/fixtures/misskey/quote.json"
-        |> File.read!()
-        |> Jason.decode!()
+      } = changes
 
-      %{
-        valid?: true,
-        changes: %{
-          quoteUri: "https://example.com/objects/43479e20-c0f8-4f49-bf7f-13fab8234924"
-        }
-      } = ArticleNotePageValidator.cast_and_validate(note)
-    end
-
-    test "a fedibird quote should work", _ do
-      Tesla.Mock.mock(fn %{
-                           method: :get,
-                           url: "https://example.com/objects/43479e20-c0f8-4f49-bf7f-13fab8234924"
-                         } ->
-        %Tesla.Env{
-          status: 200,
-          body: File.read!("test/fixtures/quoted_status.json"),
-          headers: HttpRequestMock.activitypub_object_headers()
-        }
-      end)
-
-      insert(:user, %{ap_id: "https://fedibird.com/users/akkoma_ap_integration_tester"})
-      insert(:user, %{ap_id: "https://example.com/users/user"})
-
-      note =
-        "test/fixtures/fedibird/quote.json"
-        |> File.read!()
-        |> Jason.decode!()
-
-      %{
-        valid?: true,
-        changes: %{
-          quoteUri: "https://example.com/objects/43479e20-c0f8-4f49-bf7f-13fab8234924"
-        }
-      } = ArticleNotePageValidator.cast_and_validate(note)
+      assert changes.changes[:content] == expected_content
     end
   end
 end