"to" => [user.follower_address],
"cc" => [],
"content" => "Hellow this is content.",
- "published" => "2021-01-01T00:00:00Z",
"context" => "xxx",
"summary" => "a post"
}
%{valid?: true} = ArticleNotePageValidator.cast_and_validate(note)
end
+ test "a note with a language validates" do
+ insert(:user, %{ap_id: "https://mastodon.social/users/akkoma_ap_integration_tester"})
+ note = File.read!("test/fixtures/mastodon/note_with_language.json") |> Jason.decode!()
+
+ %{
+ valid?: true,
+ changes: %{
+ contentMap: %{
+ "ja" => "<p>tag</p>"
+ }
+ }
+ } = ArticleNotePageValidator.cast_and_validate(note)
+ end
+
test "a note from factory validates" do
note = insert(:note)
%{valid?: true} = ArticleNotePageValidator.cast_and_validate(note.data)
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"})