mirror of
https://git.youjo.love/youjo/youjo-be.git
synced 2024-11-20 13:59:55 +01:00
tests: add tests for new OStatus.is_representable? function
This commit is contained in:
parent
e6d246882d
commit
c9df011215
1 changed files with 24 additions and 0 deletions
|
@ -456,4 +456,28 @@ defmodule Pleroma.Web.OStatusTest do
|
|||
"https://www.w3.org/ns/activitystreams#Public"
|
||||
]
|
||||
end
|
||||
|
||||
describe "is_representable?" do
|
||||
test "Note objects are representable" do
|
||||
note_activity = insert(:note_activity)
|
||||
|
||||
assert OStatus.is_representable?(note_activity)
|
||||
end
|
||||
|
||||
test "Article objects are not representable" do
|
||||
note_activity = insert(:note_activity)
|
||||
|
||||
note_object = Object.normalize(note_activity.data["object"])
|
||||
|
||||
note_data =
|
||||
note_object.data
|
||||
|> Map.put("type", "Article")
|
||||
|
||||
cs = Object.change(note_object, %{data: note_data})
|
||||
{:ok, article_object} = Repo.update(cs)
|
||||
|
||||
# the underlying object is now an Article instead of a note, so this should fail
|
||||
refute OStatus.is_representable?(note_activity)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue