Add more tests for Pleroma.Activity
This commit is contained in:
parent
39dc9b470c
commit
5bfbad13ad
@ -185,4 +185,35 @@ defmodule Pleroma.ActivityTest do
|
|||||||
|
|
||||||
assert [%{id: ^id1, object: %Object{}}, %{id: ^id2, object: %Object{}}] = activities
|
assert [%{id: ^id1, object: %Object{}}, %{id: ^id2, object: %Object{}}] = activities
|
||||||
end
|
end
|
||||||
|
|
||||||
|
test "get_by_id_with_object/1" do
|
||||||
|
%{id: id} = insert(:note_activity)
|
||||||
|
|
||||||
|
assert %Activity{id: ^id, object: %Object{}} = Activity.get_by_id_with_object(id)
|
||||||
|
end
|
||||||
|
|
||||||
|
test "get_by_ap_id_with_object/1" do
|
||||||
|
%{data: %{"id" => ap_id}} = insert(:note_activity)
|
||||||
|
|
||||||
|
assert %Activity{data: %{"id" => ^ap_id}, object: %Object{}} =
|
||||||
|
Activity.get_by_ap_id_with_object(ap_id)
|
||||||
|
end
|
||||||
|
|
||||||
|
test "get_by_id/1" do
|
||||||
|
%{id: id} = insert(:note_activity)
|
||||||
|
|
||||||
|
assert %Activity{id: ^id} = Activity.get_by_id(id)
|
||||||
|
end
|
||||||
|
|
||||||
|
test "all_by_actor_and_id/2" do
|
||||||
|
user = insert(:user)
|
||||||
|
|
||||||
|
{:ok, %{id: id1}} = Pleroma.Web.CommonAPI.post(user, %{"status" => "cofe"})
|
||||||
|
{:ok, %{id: id2}} = Pleroma.Web.CommonAPI.post(user, %{"status" => "cofefe"})
|
||||||
|
|
||||||
|
assert [] == Activity.all_by_actor_and_id(user, [])
|
||||||
|
|
||||||
|
assert [%Activity{id: ^id2}, %Activity{id: ^id1}] =
|
||||||
|
Activity.all_by_actor_and_id(user.ap_id, [id1, id2])
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user