transmogrifier_test: test date, anyOf and oneOf completely
This commit is contained in:
parent
89a2433154
commit
10bd08ef07
@ -12,7 +12,7 @@ defmodule Pleroma.Web.ActivityPub.ObjectValidators.QuestionOptionsValidator do
|
|||||||
embedded_schema do
|
embedded_schema do
|
||||||
field(:name, :string)
|
field(:name, :string)
|
||||||
|
|
||||||
embeds_one :replies, Replies do
|
embeds_one :replies, Replies, primary_key: false do
|
||||||
field(:totalItems, :integer)
|
field(:totalItems, :integer)
|
||||||
field(:type, :string)
|
field(:type, :string)
|
||||||
end
|
end
|
||||||
|
@ -224,14 +224,33 @@ defmodule Pleroma.Web.ActivityPub.TransmogrifierTest do
|
|||||||
|
|
||||||
object = Object.normalize(activity, false)
|
object = Object.normalize(activity, false)
|
||||||
|
|
||||||
assert Enum.all?(object.data["oneOf"], fn choice ->
|
assert object.data["closed"] == "2019-05-11T09:03:36Z"
|
||||||
choice["name"] in [
|
|
||||||
"Dunno",
|
assert object.data["anyOf"] == []
|
||||||
"Everyone knows that!",
|
|
||||||
"25 char limit is dumb",
|
assert Enum.sort(object.data["oneOf"]) ==
|
||||||
"I can't even fit a funny"
|
Enum.sort([
|
||||||
]
|
%{
|
||||||
end)
|
"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
|
end
|
||||||
|
|
||||||
test "it works for incoming listens" do
|
test "it works for incoming listens" do
|
||||||
|
Loading…
Reference in New Issue
Block a user