1 defmodule Pleroma.Web.ActivityPub.ObjectViewTest do
5 alias Pleroma.Web.ActivityPub.ObjectView
6 alias Pleroma.Web.CommonAPI
8 test "renders a note object" do
11 result = ObjectView.render("object.json", %{object: note})
13 assert result["id"] == note.data["id"]
14 assert result["to"] == note.data["to"]
15 assert result["content"] == note.data["content"]
16 assert result["type"] == "Note"
17 assert result["@context"]
20 test "renders a note activity" do
21 note = insert(:note_activity)
23 result = ObjectView.render("object.json", %{object: note})
25 assert result["id"] == note.data["id"]
26 assert result["to"] == note.data["to"]
27 assert result["object"]["type"] == "Note"
28 assert result["object"]["content"] == note.data["object"]["content"]
29 assert result["type"] == "Create"
30 assert result["@context"]
33 test "renders a like activity" do
34 note = insert(:note_activity)
37 {:ok, like_activity, _} = CommonAPI.favorite(note.id, user)
39 result = ObjectView.render("object.json", %{object: like_activity})
41 assert result["id"] == like_activity.data["id"]
42 assert result["object"] == note.data["object"]["id"]
43 assert result["type"] == "Like"
46 test "renders an announce activity" do
47 note = insert(:note_activity)
50 {:ok, announce_activity, _} = CommonAPI.repeat(note.id, user)
52 result = ObjectView.render("object.json", %{object: announce_activity})
54 assert result["id"] == announce_activity.data["id"]
55 assert result["object"] == note.data["object"]["id"]
56 assert result["type"] == "Announce"