transmogrifier_test: test date, anyOf and oneOf completely

This commit is contained in:
Haelwenn (lanodan) Monnier 2020-06-14 22:25:04 +02:00
commit 10bd08ef07
No known key found for this signature in database
GPG key ID: D5B7A8E43C997DEE
2 changed files with 28 additions and 9 deletions

View file

@ -224,14 +224,33 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
object = Object.normalize(activity, false)
assert Enum.all?(object.data["oneOf"], fn choice ->
choice["name"] in [
"Dunno",
"Everyone knows that!",
"25 char limit is dumb",
"I can't even fit a funny"
]
end)
assert object.data["closed"] == "2019-05-11T09:03:36Z"
assert object.data["anyOf"] == []
assert Enum.sort(object.data["oneOf"]) ==
Enum.sort([
%{
"name" => "25 char limit is dumb",
"replies" => %{"totalItems" => 0, "type" => "Collection"},
"type" => "Note"
},
%{
"name" => "Dunno",
"replies" => %{"totalItems" => 0, "type" => "Collection"},
"type" => "Note"
},
%{
"name" => "Everyone knows that!",
"replies" => %{"totalItems" => 1, "type" => "Collection"},
"type" => "Note"
},
%{
"name" => "I can't even fit a funny",
"replies" => %{"totalItems" => 1, "type" => "Collection"},
"type" => "Note"
}
])
end
test "it works for incoming listens" do