mandate published on notes
[akkoma] / test / pleroma / web / activity_pub / object_validators / article_note_page_validator_test.exs
index 5b95ebc51f61877867ad1b76bd3327a4e85b9897..0ddc3c76d1525340153b8bd55b5f47d9f251a5f5 100644 (file)
@@ -28,6 +28,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNotePageValidatorTest
         "to" => [user.follower_address],
         "cc" => [],
         "content" => "Hellow this is content.",
+        "published" => "2021-01-01T00:00:00Z",
         "context" => "xxx",
         "summary" => "a post"
       }
@@ -65,6 +66,12 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.ArticleNotePageValidatorTest
         ArticleNotePageValidator.cast_and_validate(note)
     end
 
+    test "a note without a published field should not validate", _ do
+      insert(:user, %{ap_id: "http://mastodon.example.org/users/admin"})
+      note = Jason.decode!(File.read!("test/fixtures/mastodon/note-without-published.json"))
+      %{valid?: false} = ArticleNotePageValidator.cast_and_validate(note)
+    end
+
     test "a note with an attachment should work", _ do
       insert(:user, %{ap_id: "https://owncast.localhost.localdomain/federation/user/streamer"})