X-Git-Url: https://git.squeep.com/?a=blobdiff_plain;f=test%2Fpleroma%2Fweb%2Factivity_pub%2Fobject_validators%2Farticle_note_page_validator_test.exs;h=7c8e5a4e15b3fef94cadaa58c1a2681ba558dbc6;hb=772c209914d5cbfd4f763edc266d0f1541f656f8;hp=4ea7a5bc029f375630f6a01479afbd91ff4d223c;hpb=ff6c8455fb0b64f979cd551fd644c5024c91ccc6;p=akkoma diff --git a/test/pleroma/web/activity_pub/object_validators/article_note_page_validator_test.exs b/test/pleroma/web/activity_pub/object_validators/article_note_page_validator_test.exs index 4ea7a5bc0..7c8e5a4e1 100644 --- a/test/pleroma/web/activity_pub/object_validators/article_note_page_validator_test.exs +++ b/test/pleroma/web/activity_pub/object_validators/article_note_page_validator_test.exs @@ -80,6 +80,12 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNotePageValidatorTest ap_id: "http://misskey.local.live/users/remote_user" }) + full_tag_remote_user = + insert(:user, %{ + nickname: "full_tag_remote_user", + ap_id: "http://misskey.local.live/users/full_tag_remote_user" + }) + insert(:user, %{ap_id: "https://misskey.local.live/users/92hzkskwgy"}) note = @@ -92,8 +98,6 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNotePageValidatorTest changes: %{ content: content, source: %{ - "content" => - "@akkoma_user @remote_user @oops_not_a_mention linkifylink #dancedance $[jelly mfm goes here] \n\n## aaa", "mediaType" => "text/x.misskeymarkdown" } } @@ -105,8 +109,13 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNotePageValidatorTest assert content =~ "@remote_user" + assert content =~ + "@full_tag_remote_user" + assert content =~ "@oops_not_a_mention" - assert content =~ "$[jelly mfm goes here]

## aaa" + + assert content =~ + "mfm goes here

aaa" end test "a misskey MFM status with a _misskey_content field should work and be linked", _ do @@ -120,19 +129,34 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNotePageValidatorTest |> File.read!() |> Jason.decode!() - expected_content = - "@akkoma_user linkifylink #dancedance $[jelly mfm goes here]

## aaa" + changes = ArticleNotePageValidator.cast_and_validate(note) %{ valid?: true, changes: %{ - content: ^expected_content, + content: content, source: %{ - "content" => "@akkoma_user linkifylink #dancedance $[jelly mfm goes here] \n\n## aaa", - "mediaType" => "text/x.misskeymarkdown" + "mediaType" => "text/x.misskeymarkdown", + "content" => "@akkoma_user linkifylink #dancedance $[jelly mfm goes here] \n\n## aaa" } } - } = ArticleNotePageValidator.cast_and_validate(note) + } = changes + + assert content =~ + "@akkoma_user" end end + + test "a Note without replies/first/items validates" do + insert(:user, ap_id: "https://mastodon.social/users/emelie") + + note = + "test/fixtures/tesla_mock/status.emelie.json" + |> File.read!() + |> Jason.decode!() + |> pop_in(["replies", "first", "items"]) + |> elem(1) + + %{valid?: true} = ArticleNotePageValidator.cast_and_validate(note) + end end